make sure doors component works without mesecons :P

master^2
Vanessa Dannenberg 2019-05-27 05:09:42 -04:00
parent a129cf177f
commit c13c3a1c8c
1 changed files with 14 additions and 7 deletions

View File

@ -1,6 +1,7 @@
-- Node definitions for Homedecor doors -- Node definitions for Homedecor doors
local S = homedecor.gettext local S = homedecor.gettext
local mesecons_mp = minetest.get_modpath("mesecons")
-- clone node -- clone node
@ -142,7 +143,7 @@ local old_doors = {}
local mesecons local mesecons
-- This part blatantly copied from Mesecons, and modified :-) -- This part blatantly copied from Mesecons, and modified :-)
if minetest.get_modpath("mesecons") then if mesecons_mp then
mesecons = { mesecons = {
effector = { effector = {
action_on = function(pos, node) action_on = function(pos, node)
@ -316,13 +317,16 @@ for i, g in ipairs(gate_list) do
homedecor.flip_gate(pos, node, clicker, gate, "closed") homedecor.flip_gate(pos, node, clicker, gate, "closed")
return itemstack return itemstack
end, end,
mesecons = { }
if mesecons_mp then
def.mesecons = {
effector = { effector = {
rules = mesecon.rules.pplate, rules = mesecon.rules.pplate,
action_on = function(pos,node) homedecor.flip_gate(pos,node,nil,gate, "closed") end action_on = function(pos,node) homedecor.flip_gate(pos,node,nil,gate, "closed") end
} }
} }
} end
-- gates when placed default to closed, closed. -- gates when placed default to closed, closed.
@ -346,10 +350,13 @@ for i, g in ipairs(gate_list) do
homedecor.flip_gate(pos, node, clicker, gate, "open") homedecor.flip_gate(pos, node, clicker, gate, "open")
return itemstack return itemstack
end end
def.mesecons.effector = {
rules = mesecon.rules.pplate, if mesecons_mp then
action_off = function(pos,node) homedecor.flip_gate(pos,node,nil,gate, "open") end def.mesecons.effector = {
} rules = mesecon.rules.pplate,
action_off = function(pos,node) homedecor.flip_gate(pos,node,nil,gate, "open") end
}
end
minetest.register_node(":homedecor:gate_"..gate.."_open", def) minetest.register_node(":homedecor:gate_"..gate.."_open", def)
end end