From c28df63aae832e1a029786b581fc777973500ecd Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Sun, 26 May 2019 21:49:19 -0400 Subject: [PATCH] add mesecons support to doors --- homedecor_doors_and_gates/init.lua | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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", {