Skip to content

Commit fe9c687

Browse files
committedFeb 15, 2016
Fix pistons not connecting to wire and not activating when placing
up/down pistons from certain directions
1 parent 7865d42 commit fe9c687

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed
 

‎mesecons_pistons/init.lua

+10-4
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,16 @@ local piston_orientate = function(pos, placer)
117117

118118
local node = minetest.get_node(pos)
119119
local pistonspec = minetest.registered_nodes[node.name].mesecons_piston
120-
if pitch > 55 then --looking upwards
121-
minetest.set_node(pos, {name=pistonspec.piston_down})
122-
elseif pitch < -55 then --looking downwards
123-
minetest.set_node(pos, {name=pistonspec.piston_up})
120+
121+
-- looking upwards (pitch > 55) / looking downwards (pitch < -55)
122+
local nn = nil
123+
if pitch > 55 then nn = {name = pistonspec.piston_down} end
124+
if pitch < -55 then nn = {name = pistonspec.piston_up} end
125+
126+
if nn then
127+
minetest.set_node(pos, nn)
128+
-- minetest.after, because on_placenode for unoriented piston must be processed first
129+
minetest.after(0, mesecon.on_placenode, pos, nn)
124130
end
125131
end
126132

0 commit comments

Comments
 (0)