mirror of
https://codeberg.org/minenux/minetest-mod-xdecor
synced 2023-10-20 21:43:39 -07:00
Pressure plates : fix set_node being called twice + some other fixes
This commit is contained in:
parent
cd8d90f244
commit
21cf911db0
@ -6,11 +6,17 @@ local function door_toggle(pos_actuator, pos_door, player)
|
||||
local actuator = minetest.get_node(pos_actuator)
|
||||
local door = doors.get(pos_door)
|
||||
|
||||
minetest.set_node(pos_actuator, {name=actuator.name:gsub("_off", "_on"), param2=actuator.param2})
|
||||
if actuator.name:sub(-4) == "_off" then
|
||||
minetest.set_node(pos_actuator,
|
||||
{name=actuator.name:gsub("_off", "_on"), param2=actuator.param2})
|
||||
end
|
||||
door:open(player)
|
||||
|
||||
minetest.after(2, function()
|
||||
minetest.set_node(pos_actuator, {name=actuator.name, param2=actuator.param2})
|
||||
if minetest.get_node(pos_actuator).name:sub(-3) == "_on" then
|
||||
minetest.set_node(pos_actuator,
|
||||
{name=actuator.name, param2=actuator.param2})
|
||||
end
|
||||
door:close(player)
|
||||
end)
|
||||
end
|
||||
@ -32,6 +38,7 @@ function plate.timer(pos)
|
||||
for i = 1, #doors do
|
||||
door_toggle(pos, doors[i], player)
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
Loading…
x
Reference in New Issue
Block a user