diff options
author | cheapie <no-email-for-you@example.com> | 2024-04-19 11:24:33 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2024-04-19 11:24:33 -0500 |
commit | c3d04606a3b4da5181ce3467cb9e77d6a4e61b04 (patch) | |
tree | 15c8277c9a9ed0bddf2f419d24a93bcdc74ad19d /controller.lua | |
parent | 52821fcc17d7b17c5bb9f6ccbb1c13cbdddf71b2 (diff) | |
download | celevator-c3d04606a3b4da5181ce3467cb9e77d6a4e61b04.tar celevator-c3d04606a3b4da5181ce3467cb9e77d6a4e61b04.tar.gz celevator-c3d04606a3b4da5181ce3467cb9e77d6a4e61b04.tar.bz2 celevator-c3d04606a3b4da5181ce3467cb9e77d6a4e61b04.tar.xz celevator-c3d04606a3b4da5181ce3467cb9e77d6a4e61b04.zip |
Initial dispatcher work (not yet functional)
Diffstat (limited to 'controller.lua')
-rw-r--r-- | controller.lua | 11 |
1 files changed, 11 insertions, 0 deletions
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 "") |