Final door toggle crash fix
This commit is contained in:
parent
79f97a1569
commit
5dfbf7c6e7
@ -14,14 +14,16 @@ local function door_toggle(pos_actuator, pos_door, player)
|
||||
minetest.set_node(pos_actuator,
|
||||
{name=actuator.name:gsub("_off", "_on"), param2=actuator.param2})
|
||||
end
|
||||
door:open(player_name)
|
||||
door:open(player)
|
||||
|
||||
minetest.after(2, function()
|
||||
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_name)
|
||||
-- Re-get player object (or nil) because 'player' could
|
||||
-- be an invalid object at this time (player left)
|
||||
door:close(minetest.get_player_by_name(player_name))
|
||||
end)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user