diff options
author | Jeija <norrepli@gmail.com> | 2016-02-15 16:35:38 +0100 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2016-02-15 16:36:27 +0100 |
commit | fe9c6871de5db8add9ef196a088b975ed51a4eba (patch) | |
tree | abad1a0e135cd893baa5f7b03c24260e3572027d | |
parent | 7865d428348e64b4aa2877830fd97a283b0ae44e (diff) | |
download | mesecons-fe9c6871de5db8add9ef196a088b975ed51a4eba.tar mesecons-fe9c6871de5db8add9ef196a088b975ed51a4eba.tar.gz mesecons-fe9c6871de5db8add9ef196a088b975ed51a4eba.tar.bz2 mesecons-fe9c6871de5db8add9ef196a088b975ed51a4eba.tar.xz mesecons-fe9c6871de5db8add9ef196a088b975ed51a4eba.zip |
Fix pistons not connecting to wire and not activating when placing
up/down pistons from certain directions
-rw-r--r-- | mesecons_pistons/init.lua | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua index 49710d3..474f621 100644 --- a/mesecons_pistons/init.lua +++ b/mesecons_pistons/init.lua @@ -117,10 +117,16 @@ local piston_orientate = function(pos, placer) local node = minetest.get_node(pos) local pistonspec = minetest.registered_nodes[node.name].mesecons_piston - if pitch > 55 then --looking upwards - minetest.set_node(pos, {name=pistonspec.piston_down}) - elseif pitch < -55 then --looking downwards - minetest.set_node(pos, {name=pistonspec.piston_up}) + + -- looking upwards (pitch > 55) / looking downwards (pitch < -55) + local nn = nil + if pitch > 55 then nn = {name = pistonspec.piston_down} end + if pitch < -55 then nn = {name = pistonspec.piston_up} end + + if nn then + minetest.set_node(pos, nn) + -- minetest.after, because on_placenode for unoriented piston must be processed first + minetest.after(0, mesecon.on_placenode, pos, nn) end end |