Skip to content

Commit e707afe

Browse files
committedFeb 24, 2013
Don't totally force deactivation of block two below the pressure plate if connected to a receptor
1 parent 2848df0 commit e707afe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎mesecons_pressureplates/init.lua

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,23 @@ pp_on_timer = function (pos, elapsed)
1717
if not ppspec then return end
1818

1919
local objs = minetest.env:get_objects_inside_radius(pos, 1)
20+
local two_below = mesecon:addPosRule(pos, {x = 0, y = -2, z = 0})
2021

2122
if objs[1] == nil and node.name == ppspec.onstate then
2223
minetest.env:add_node(pos, {name = ppspec.offstate})
2324
mesecon:receptor_off(pos)
2425
-- force deactivation of mesecon two blocks below (hacky)
25-
mesecon:turnoff(mesecon:addPosRule(pos, {x = 0, y = -2, z = 0}))
26+
if not mesecon:connected_to_receptor(two_below) then
27+
mesecon:turnoff(two_below)
28+
end
2629
else
2730
for k, obj in pairs(objs) do
2831
local objpos = obj:getpos()
2932
if objpos.y > pos.y-1 and objpos.y < pos.y then
3033
minetest.env:add_node(pos, {name=ppspec.onstate})
3134
mesecon:receptor_on(pos)
3235
-- force activation of mesecon two blocks below (hacky)
33-
mesecon:turnon(mesecon:addPosRule(pos, {x = 0, y = -2, z = 0}))
36+
mesecon:turnon(two_below)
3437
end
3538
end
3639
end

0 commit comments

Comments
 (0)
Please sign in to comment.