summaryrefslogtreecommitdiff
path: root/fs1switch.lua
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2024-04-20 13:22:16 -0500
committercheapie <no-email-for-you@example.com>2024-04-20 13:22:16 -0500
commit88a24a1fe8186fb81347ff2d61903ddfdb1752bc (patch)
tree20e55c604d53defb6e5db9c0b69bd53820924b5a /fs1switch.lua
parented7e12a7bb03b2424a12d43857085cade10eae8b (diff)
downloadcelevator-88a24a1fe8186fb81347ff2d61903ddfdb1752bc.tar
celevator-88a24a1fe8186fb81347ff2d61903ddfdb1752bc.tar.gz
celevator-88a24a1fe8186fb81347ff2d61903ddfdb1752bc.tar.bz2
celevator-88a24a1fe8186fb81347ff2d61903ddfdb1752bc.tar.xz
celevator-88a24a1fe8186fb81347ff2d61903ddfdb1752bc.zip
Finish communication of other items with dispatcher
Diffstat (limited to 'fs1switch.lua')
-rw-r--r--fs1switch.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/fs1switch.lua b/fs1switch.lua
index 8c426cc..d48ff8e 100644
--- a/fs1switch.lua
+++ b/fs1switch.lua
@@ -50,12 +50,26 @@ local function rightclick(pos,node,player)
local carinfo = minetest.deserialize(celevator.storage:get_string(string.format("car%d",carid)))
if not carinfo then return end
local controllerpos = carinfo.controllerpos
+ local dispatcher = false
+ if not controllerpos then
+ controllerpos = carinfo.dispatcherpos
+ dispatcher = true
+ end
+ if not controllerpos then return end
local controllermeta = minetest.get_meta(controllerpos)
if controllermeta:get_int("carid") ~= carid then return end
if node.name == "celevator:fs1switch_reset" or node.name == "celevator:fs1switch_reset_lit" then
- celevator.controller.handlefs1switch(controllerpos,false)
+ if dispatcher then
+ celevator.dispatcher.handlefs1switch(controllerpos,false)
+ else
+ celevator.controller.handlefs1switch(controllerpos,false)
+ end
elseif node.name == "celevator:fs1switch_on" or node.name == "celevator:fs1switch_on_lit" then
- celevator.controller.handlefs1switch(controllerpos,true)
+ if dispatcher then
+ celevator.dispatcher.handlefs1switch(controllerpos,true)
+ else
+ celevator.controller.handlefs1switch(controllerpos,true)
+ end
end
end