diff --git a/homedecor_doors_and_gates/init.lua b/homedecor_doors_and_gates/init.lua index effc6951..47ab385d 100644 --- a/homedecor_doors_and_gates/init.lua +++ b/homedecor_doors_and_gates/init.lua @@ -114,6 +114,28 @@ local door_list = { } local old_doors = {} +local mesecons + +-- This part blatantly copied from Mesecons, and modified :-) +if minetest.get_modpath("mesecons") then + mesecons = { + effector = { + action_on = function(pos, node) + local door = doors.get(pos) + if door then + door:open() + end + end, + action_off = function(pos, node) + local door = doors.get(pos) + if door then + door:close() + end + end, + rules = mesecon.rules.pplate + } + } +end for _, door in ipairs(door_list) do doors.register(door.name, { @@ -123,7 +145,8 @@ for _, door in ipairs(door_list) do groups = table.copy(door.groups), sounds = door.sounds.main, sound_open = door.sounds.open, - sound_close = door.sounds.close + sound_close = door.sounds.close, + mesecons = mesecons }) if door.alpha then minetest.override_item("doors:"..door.name.."_a", {