diff options
author | Jeija <norrepli@gmail.com> | 2012-08-17 23:48:09 +0200 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2012-08-17 23:48:09 +0200 |
commit | c5bf95f79dfc1f5f492e883e830f587b9cb9c695 (patch) | |
tree | a13c224b04e309ce16cb512b11c2a5cb04acc0fb | |
parent | fe1606eb319d80b1195f9819c7a1716897efdcd1 (diff) | |
download | mesecons-c5bf95f79dfc1f5f492e883e830f587b9cb9c695.tar mesecons-c5bf95f79dfc1f5f492e883e830f587b9cb9c695.tar.gz mesecons-c5bf95f79dfc1f5f492e883e830f587b9cb9c695.tar.bz2 mesecons-c5bf95f79dfc1f5f492e883e830f587b9cb9c695.tar.xz mesecons-c5bf95f79dfc1f5f492e883e830f587b9cb9c695.zip |
Some fix for walllever/button receiver digging
-rw-r--r-- | mesecons_receiver/init.lua | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/mesecons_receiver/init.lua b/mesecons_receiver/init.lua index c203102..dca1e22 100644 --- a/mesecons_receiver/init.lua +++ b/mesecons_receiver/init.lua @@ -47,14 +47,14 @@ end mesecon:register_conductor("mesecons_receiver:receiver_on", "mesecons_receiver:receiver_off", mesecon:get_rules("mesecon_receiver_all"), receiver_get_rules) -function mesecon:receiver_get_pos_from_rcpt(pos) - node = minetest.env:get_node(pos) +function mesecon:receiver_get_pos_from_rcpt(pos, param2) local rules = mesecon:get_rules("receiver_pos") - if node.param2 == 2 then + if param2 == nil then param2 = minetest.env:get_node(pos).param2 end + if param2 == 2 then rules = mesecon:rotate_rules_left(rules) - elseif node.param2 == 3 then + elseif param2 == 3 then rules = mesecon:rotate_rules_right(mesecon:rotate_rules_right(rules)) - elseif node.param2 == 0 then + elseif param2 == 0 then rules = mesecon:rotate_rules_right(rules) end np = { @@ -66,8 +66,8 @@ end function mesecon:receiver_place(rcpt_pos) local node = minetest.env:get_node(rcpt_pos) - pos = mesecon:receiver_get_pos_from_rcpt(rcpt_pos, node.param2) - nn = minetest.env:get_node(pos) + local pos = mesecon:receiver_get_pos_from_rcpt(rcpt_pos, node.param2) + local nn = minetest.env:get_node(pos) if string.find(nn.name, "mesecons:wire_") ~= nil then minetest.env:dig_node(pos) @@ -76,11 +76,11 @@ function mesecon:receiver_place(rcpt_pos) end end -function mesecon:receiver_remove(rcpt_pos) - pos = mesecon:receiver_get_pos_from_rcpt(rcpt_pos) - node = minetest.env:get_node(pos) - - if string.find(node.name, "mesecons_receiver:receiver_") ~=nil then +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"}) mesecon:update_autoconnect(pos) @@ -95,7 +95,7 @@ end) minetest.register_on_dignode(function(pos, node) if minetest.get_item_group(node.name, "mesecon_needs_receiver") == 1 then - mesecon:receiver_remove(pos) + mesecon:receiver_remove(pos, node) end end) |