Add nil check in doors_toggle (#126)

Add nil check to prevent errors xdecor caused in combination with pkarcs_doors.
This commit is contained in:
Elias Fleckenstein 2020-08-26 10:13:25 +02:00 committed by GitHub
parent 5b0b4f3b56
commit 841a033983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,8 @@ local function door_toggle(pos_actuator, pos_door, player)
local player_name = player:get_player_name()
local actuator = minetest.get_node(pos_actuator)
local door = doors.get(pos_door)
if not door then return end
if actuator.name:sub(-4) == "_off" then
minetest.set_node(pos_actuator,
{name = actuator.name:gsub("_off", "_on"), param2 = actuator.param2})