From 8bf5b7d0e4d2988cd7b4c5370d722dcf4d215e4f Mon Sep 17 00:00:00 2001 From: Jeija Date: Sat, 14 Feb 2015 00:02:19 +0100 Subject: Fix #219, do not try to override unregistered doors --- mesecons_doors/init.lua | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'mesecons_doors') diff --git a/mesecons_doors/init.lua b/mesecons_doors/init.lua index 164750a..dca8b4d 100644 --- a/mesecons_doors/init.lua +++ b/mesecons_doors/init.lua @@ -20,6 +20,8 @@ local function on_rightclick(pos, dir, check_name, replace, replace_dir, params) end local function meseconify_door(name) + if not minetest.registered_items[name] then return end + local function toggle_state1 (pos, node) on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0}) end @@ -65,16 +67,18 @@ local function trapdoor_switch(pos, node) minetest.get_meta(pos):set_int("state", state == 1 and 0 or 1) end -minetest.override_item("doors:trapdoor", { - mesecons = {effector = { - action_on = trapdoor_switch, - action_off = trapdoor_switch - }}, -}) +if minetest.registered_nodes["doors:trapdoor"] then + minetest.override_item("doors:trapdoor", { + mesecons = {effector = { + action_on = trapdoor_switch, + action_off = trapdoor_switch + }}, + }) -minetest.override_item("doors:trapdoor_open", { - mesecons = {effector = { - action_on = trapdoor_switch, - action_off = trapdoor_switch - }}, -}) + minetest.override_item("doors:trapdoor_open", { + mesecons = {effector = { + action_on = trapdoor_switch, + action_off = trapdoor_switch + }}, + }) +end -- cgit v1.2.3