Skip to content

Commit

Permalink
Fix pistons not connecting to wire and not activating when placing
Browse files Browse the repository at this point in the history
up/down pistons from certain directions
  • Loading branch information
Jeija committed Feb 15, 2016
1 parent 7865d42 commit fe9c687
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mesecons_pistons/init.lua
Expand Up @@ -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

Expand Down

0 comments on commit fe9c687

Please sign in to comment.