forked from minetest-mods/mesecons
Fix #219, do not try to override unregistered doors
This commit is contained in:
parent
14281a1bd4
commit
8bf5b7d0e4
|
@ -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,16 +67,18 @@ 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
|
||||||
|
|
||||||
minetest.override_item("doors:trapdoor", {
|
if minetest.registered_nodes["doors:trapdoor"] then
|
||||||
mesecons = {effector = {
|
minetest.override_item("doors:trapdoor", {
|
||||||
action_on = trapdoor_switch,
|
mesecons = {effector = {
|
||||||
action_off = trapdoor_switch
|
action_on = trapdoor_switch,
|
||||||
}},
|
action_off = trapdoor_switch
|
||||||
})
|
}},
|
||||||
|
})
|
||||||
|
|
||||||
minetest.override_item("doors:trapdoor_open", {
|
minetest.override_item("doors:trapdoor_open", {
|
||||||
mesecons = {effector = {
|
mesecons = {effector = {
|
||||||
action_on = trapdoor_switch,
|
action_on = trapdoor_switch,
|
||||||
action_off = trapdoor_switch
|
action_off = trapdoor_switch
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user