diff options
author | Jeija <norrepli@gmail.com> | 2015-02-14 00:02:19 +0100 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2015-02-14 00:02:19 +0100 |
commit | 8bf5b7d0e4d2988cd7b4c5370d722dcf4d215e4f (patch) | |
tree | ebe9fec412b21617421cb81f00f628a2ff0b5f8b | |
parent | 14281a1bd4e9b24d2c270169d963186fec9e6e29 (diff) | |
download | mesecons-8bf5b7d0e4d2988cd7b4c5370d722dcf4d215e4f.tar mesecons-8bf5b7d0e4d2988cd7b4c5370d722dcf4d215e4f.tar.gz mesecons-8bf5b7d0e4d2988cd7b4c5370d722dcf4d215e4f.tar.bz2 mesecons-8bf5b7d0e4d2988cd7b4c5370d722dcf4d215e4f.tar.xz mesecons-8bf5b7d0e4d2988cd7b4c5370d722dcf4d215e4f.zip |
Fix #219, do not try to override unregistered doors
-rw-r--r-- | mesecons_doors/init.lua | 28 |
1 files changed, 16 insertions, 12 deletions
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 |