From 88a24a1fe8186fb81347ff2d61903ddfdb1752bc Mon Sep 17 00:00:00 2001 From: cheapie Date: Sat, 20 Apr 2024 13:22:16 -0500 Subject: Finish communication of other items with dispatcher --- fs1switch.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'fs1switch.lua') 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 -- cgit v1.2.3