File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -117,10 +117,16 @@ local piston_orientate = function(pos, placer)
117
117
118
118
local node = minetest .get_node (pos )
119
119
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 )
124
130
end
125
131
end
126
132
You can’t perform that action at this time.
0 commit comments