add mesecons support to doors

This commit is contained in:
Vanessa Dannenberg 2019-05-26 21:49:19 -04:00
parent e767b08011
commit c28df63aae
1 changed files with 24 additions and 1 deletions

View File

@ -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", {