diff options
author | Jeija <norrepli@gmail.com> | 2012-08-19 10:38:44 +0200 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2012-08-19 10:38:44 +0200 |
commit | 48337a4df88de21c8ed16fd7e991701eabda2fb1 (patch) | |
tree | da63c1c37cc30be0958e30703c9537d3ed77ce11 | |
parent | d95fb26ca554c039993b7baca5a9e110582ab2aa (diff) | |
download | mesecons-48337a4df88de21c8ed16fd7e991701eabda2fb1.tar mesecons-48337a4df88de21c8ed16fd7e991701eabda2fb1.tar.gz mesecons-48337a4df88de21c8ed16fd7e991701eabda2fb1.tar.bz2 mesecons-48337a4df88de21c8ed16fd7e991701eabda2fb1.tar.xz mesecons-48337a4df88de21c8ed16fd7e991701eabda2fb1.zip |
Fix bug when placing a wire (receiver) to an onstate-walllever/button
-rw-r--r-- | mesecons_receiver/init.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mesecons_receiver/init.lua b/mesecons_receiver/init.lua index fc84bca..b5119ec 100644 --- a/mesecons_receiver/init.lua +++ b/mesecons_receiver/init.lua @@ -115,7 +115,12 @@ function mesecon:receiver_place(rcpt_pos) if string.find(nn.name, "mesecons:wire_") ~= nil then minetest.env:dig_node(pos) - minetest.env:add_node(pos, {name = "mesecons_receiver:receiver_off", param2 = node.param2}) + if mesecon:is_power_on(rcpt_pos) then + minetest.env:add_node(pos, {name = "mesecons_receiver:receiver_on", param2 = node.param2}) + mesecon:receptor_on(pos, receiver_get_rules(node.param2)) + else + minetest.env:add_node(pos, {name = "mesecons_receiver:receiver_off", param2 = node.param2}) + end mesecon:update_autoconnect(pos) end end @@ -123,7 +128,6 @@ end function mesecon:receiver_remove(rcpt_pos, dugnode) local pos = mesecon:receiver_get_pos_from_rcpt(rcpt_pos, dugnode.param2) local nn = minetest.env:get_node(pos) - print(nn.name) if string.find(nn.name, "mesecons_receiver:receiver_") ~=nil then minetest.env:dig_node(pos) minetest.env:place_node(pos, {name = "mesecons:wire_00000000_off"}) |