Fix #219, do not try to override unregistered doors

This commit is contained in:
Jeija 2015-02-14 00:02:19 +01:00
parent 14281a1bd4
commit 8bf5b7d0e4

View File

@ -20,6 +20,8 @@ local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
end end
local function meseconify_door(name) local function meseconify_door(name)
if not minetest.registered_items[name] then return end
local function toggle_state1 (pos, node) local function toggle_state1 (pos, node)
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0}) on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
end end
@ -65,6 +67,7 @@ local function trapdoor_switch(pos, node)
minetest.get_meta(pos):set_int("state", state == 1 and 0 or 1) minetest.get_meta(pos):set_int("state", state == 1 and 0 or 1)
end end
if minetest.registered_nodes["doors:trapdoor"] then
minetest.override_item("doors:trapdoor", { minetest.override_item("doors:trapdoor", {
mesecons = {effector = { mesecons = {effector = {
action_on = trapdoor_switch, action_on = trapdoor_switch,
@ -78,3 +81,4 @@ minetest.override_item("doors:trapdoor_open", {
action_off = trapdoor_switch action_off = trapdoor_switch
}}, }},
}) })
end