summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeija <norrepli@gmail.com>2013-02-24 19:09:07 +0100
committerJeija <norrepli@gmail.com>2013-02-24 19:09:07 +0100
commite707afef1a4b6f8f9a7342e9c96d5b5ccb205f45 (patch)
tree744866bbb90615833bfa5814fc745f2e099ba2fa
parent2848df007ee083f40200bbefce892ad7e2bd2c7f (diff)
downloadmesecons-e707afef1a4b6f8f9a7342e9c96d5b5ccb205f45.tar
mesecons-e707afef1a4b6f8f9a7342e9c96d5b5ccb205f45.tar.gz
mesecons-e707afef1a4b6f8f9a7342e9c96d5b5ccb205f45.tar.bz2
mesecons-e707afef1a4b6f8f9a7342e9c96d5b5ccb205f45.tar.xz
mesecons-e707afef1a4b6f8f9a7342e9c96d5b5ccb205f45.zip
Don't totally force deactivation of block two below the pressure plate if connected to a receptor
-rw-r--r--mesecons_pressureplates/init.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesecons_pressureplates/init.lua b/mesecons_pressureplates/init.lua
index 68c9efa..87b3bb9 100644
--- a/mesecons_pressureplates/init.lua
+++ b/mesecons_pressureplates/init.lua
@@ -17,12 +17,15 @@ pp_on_timer = function (pos, elapsed)
if not ppspec then return end
local objs = minetest.env:get_objects_inside_radius(pos, 1)
+ local two_below = mesecon:addPosRule(pos, {x = 0, y = -2, z = 0})
if objs[1] == nil and node.name == ppspec.onstate then
minetest.env:add_node(pos, {name = ppspec.offstate})
mesecon:receptor_off(pos)
-- force deactivation of mesecon two blocks below (hacky)
- mesecon:turnoff(mesecon:addPosRule(pos, {x = 0, y = -2, z = 0}))
+ if not mesecon:connected_to_receptor(two_below) then
+ mesecon:turnoff(two_below)
+ end
else
for k, obj in pairs(objs) do
local objpos = obj:getpos()
@@ -30,7 +33,7 @@ pp_on_timer = function (pos, elapsed)
minetest.env:add_node(pos, {name=ppspec.onstate})
mesecon:receptor_on(pos)
-- force activation of mesecon two blocks below (hacky)
- mesecon:turnon(mesecon:addPosRule(pos, {x = 0, y = -2, z = 0}))
+ mesecon:turnon(two_below)
end
end
end