mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-12-25 09:50:19 +01:00
Make pressure plates and object detector use the new rules system
This commit is contained in:
parent
2601d550c3
commit
e50639291c
@ -40,7 +40,7 @@ minetest.register_abm(
|
|||||||
end
|
end
|
||||||
local objpos=obj:getpos()
|
local objpos=obj:getpos()
|
||||||
minetest.env:add_node(pos, {name="mesecons_detector:object_detector_on"})
|
minetest.env:add_node(pos, {name="mesecons_detector:object_detector_on"})
|
||||||
mesecon:receptor_on(pos, "pressureplate")
|
mesecon:receptor_on(pos, mesecon:get_rules("pressureplate"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -68,7 +68,7 @@ minetest.register_abm(
|
|||||||
end
|
end
|
||||||
if objectfound==0 then
|
if objectfound==0 then
|
||||||
minetest.env:add_node(pos, {name="mesecons_detector:object_detector_off"})
|
minetest.env:add_node(pos, {name="mesecons_detector:object_detector_off"})
|
||||||
mesecon:receptor_off(pos, "pressureplate")
|
mesecon:receptor_off(pos, mesecon:get_rules("pressureplate"))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -76,7 +76,7 @@ minetest.register_abm(
|
|||||||
minetest.register_on_dignode(
|
minetest.register_on_dignode(
|
||||||
function(pos, oldnode, digger)
|
function(pos, oldnode, digger)
|
||||||
if oldnode.name == "mesecons_detector:object_detector_on" then
|
if oldnode.name == "mesecons_detector:object_detector_on" then
|
||||||
mesecon:receptor_off(pos, "pressureplate")
|
mesecon:receptor_off(pos, mesecon:get_rules("pressureplate"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
@ -45,7 +45,7 @@ minetest.register_abm(
|
|||||||
local objpos=obj:getpos()
|
local objpos=obj:getpos()
|
||||||
if objpos.y>pos.y-1 and objpos.y<pos.y then
|
if objpos.y>pos.y-1 and objpos.y<pos.y then
|
||||||
minetest.env:add_node(pos, {name="mesecons_pressureplates:pressure_plate_wood_on"})
|
minetest.env:add_node(pos, {name="mesecons_pressureplates:pressure_plate_wood_on"})
|
||||||
mesecon:receptor_on(pos, "pressureplate")
|
mesecon:receptor_on(pos, mesecon:get_rules("pressureplate"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -59,7 +59,7 @@ minetest.register_abm(
|
|||||||
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
||||||
if objs[1]==nil then
|
if objs[1]==nil then
|
||||||
minetest.env:add_node(pos, {name="mesecons_pressureplates:pressure_plate_wood_off"})
|
minetest.env:add_node(pos, {name="mesecons_pressureplates:pressure_plate_wood_off"})
|
||||||
mesecon:receptor_off(pos, "pressureplate")
|
mesecon:receptor_off(pos, mesecon:get_rules("pressureplate"))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -67,7 +67,7 @@ minetest.register_abm(
|
|||||||
minetest.register_on_dignode(
|
minetest.register_on_dignode(
|
||||||
function(pos, oldnode, digger)
|
function(pos, oldnode, digger)
|
||||||
if oldnode.name == "mesecons_pressureplates:pressure_plate_wood_on" then
|
if oldnode.name == "mesecons_pressureplates:pressure_plate_wood_on" then
|
||||||
mesecon:receptor_off(pos, "pressureplate")
|
mesecon:receptor_off(pos, mesecon:get_rules("pressureplate"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@ -122,7 +122,7 @@ minetest.register_abm(
|
|||||||
local objpos=obj:getpos()
|
local objpos=obj:getpos()
|
||||||
if objpos.y>pos.y-1 and objpos.y<pos.y then
|
if objpos.y>pos.y-1 and objpos.y<pos.y then
|
||||||
minetest.env:add_node(pos, {name="mesecons_pressureplates:pressure_plate_stone_on"})
|
minetest.env:add_node(pos, {name="mesecons_pressureplates:pressure_plate_stone_on"})
|
||||||
mesecon:receptor_on(pos, "pressureplate")
|
mesecon:receptor_on(pos, mesecon:get_rules("pressureplate"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -136,7 +136,7 @@ minetest.register_abm(
|
|||||||
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
||||||
if objs[1]==nil then
|
if objs[1]==nil then
|
||||||
minetest.env:add_node(pos, {name="mesecons_pressureplates:pressure_plate_stone_off"})
|
minetest.env:add_node(pos, {name="mesecons_pressureplates:pressure_plate_stone_off"})
|
||||||
mesecon:receptor_off(pos, "pressureplate")
|
mesecon:receptor_off(pos, mesecon:get_rules("pressureplate"))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -144,7 +144,7 @@ minetest.register_abm(
|
|||||||
minetest.register_on_dignode(
|
minetest.register_on_dignode(
|
||||||
function(pos, oldnode, digger)
|
function(pos, oldnode, digger)
|
||||||
if oldnode.name == "mesecons_pressureplates:pressure_plate_stone_on" then
|
if oldnode.name == "mesecons_pressureplates:pressure_plate_stone_on" then
|
||||||
mesecon:receptor_off(pos, "pressureplate")
|
mesecon:receptor_off(pos, mesecons:get_rules("pressureplate"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@ -166,4 +166,5 @@ mesecon:add_rules("pressureplate",
|
|||||||
{x=-1, y=-1, z=0},
|
{x=-1, y=-1, z=0},
|
||||||
{x=-1, y=0, z=0},
|
{x=-1, y=0, z=0},
|
||||||
{x=0, y=-1, z=0},
|
{x=0, y=-1, z=0},
|
||||||
|
{x=0, y=-2, z=0},
|
||||||
{x=0, y=1, z=0}})
|
{x=0, y=1, z=0}})
|
||||||
|
Loading…
Reference in New Issue
Block a user