From c3d04606a3b4da5181ce3467cb9e77d6a4e61b04 Mon Sep 17 00:00:00 2001 From: cheapie Date: Fri, 19 Apr 2024 11:24:33 -0500 Subject: Initial dispatcher work (not yet functional) --- controller.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'controller.lua') diff --git a/controller.lua b/controller.lua index ce5c666..287983e 100644 --- a/controller.lua +++ b/controller.lua @@ -528,6 +528,17 @@ function celevator.controller.finish(pos,mem,changedinterrupts) if (mem.copformspec ~= oldmem.copformspec or mem.switchformspec ~= oldmem.switchformspec) and drivetype then minetest.after(0.25,celevator.drives[drivetype].updatecopformspec,drivepos) end + for _,message in ipairs(mem.messages) do + local destinfo = minetest.deserialize(celevator.storage:get_string(string.format("car%d",message.carid))) + if destinfo and destinfo.dispatcherpos then + celevator.dispatcher.run(destinfo.dispatcherpos,{ + type = "controllermsg", + source = mem.carid, + channel = message.channel, + msg = message.message, + }) + end + end meta:set_string("mem",minetest.serialize(mem)) if node.name == "celevator:controller_open" then meta:set_string("formspec",mem.formspec or "") end meta:set_string("formspec_hidden",mem.formspec or "") -- cgit v1.2.3