From e34f1bd16618a448527ee1c9178c8cee04f8e3df Mon Sep 17 00:00:00 2001 From: autocommitter Date: Mon, 22 Apr 2024 14:56:25 +0200 Subject: State at 2022-03-06 --- durt/nodes/(-4599,7,-6502).lua | 17 ++++++++++++----- durt/nodes/(-4623,7,-6597).lua | 17 +++++++++++++---- durt/nodes/(-4626,7,-6638).lua | 18 +++++++----------- 3 files changed, 32 insertions(+), 20 deletions(-) (limited to 'durt/nodes') diff --git a/durt/nodes/(-4599,7,-6502).lua b/durt/nodes/(-4599,7,-6502).lua index 0fa580c..6040727 100644 --- a/durt/nodes/(-4599,7,-6502).lua +++ b/durt/nodes/(-4599,7,-6502).lua @@ -1,13 +1,20 @@ -if event.train and atc_arrow then - local rc = get_rc() or "" - if rc:match("BFT_Mainline_Headshunt") then - schedule_in(";01",atc_id) +if event.train then + if atc_arrow then + if F.has_rc("BFT_Mainline_Headshunt") then + schedule_in(";01",atc_id) + print("Train's id: " ..atc_id) + return + end + else + if not F.has_rc("BFT_rejoin_from_north") then return end + atc_send("CplD1S1") return end end if event.schedule then - if event.msg == atc_id then + print("Msg id: "..event.msg) + if atc_id and event.msg == atc_id then schedule_in(";01",event.msg) return else diff --git a/durt/nodes/(-4623,7,-6597).lua b/durt/nodes/(-4623,7,-6597).lua index 4095975..649ba8b 100644 --- a/durt/nodes/(-4623,7,-6597).lua +++ b/durt/nodes/(-4623,7,-6597).lua @@ -1,6 +1,15 @@ local split_indicator = POS(-4630,8,-6589) __approach_callback_mode = 1 +local shunt_actions = { + "BFT_Siding_B", + "BFT_shunt_platforms", + "BFT_shunt_around_Track2", + "BFT_Mainline_Headshunt", + "BFT_rejoin_from_north", + "BFT_Platform1" +} + if event.approach and not event.has_entered then if F.has_rc("BFT_around_test") == false then return end @@ -13,14 +22,14 @@ if event.train then if not atc_arrow then return end local state = getstate(split_indicator) if state == "off" then - split_off_locomotive("A0B0OL",1) + split_off_locomotive("A0B0OR",1) atc_send("S3") atc_set_ars_disable(false) setstate(split_indicator,"on") - set_rc((get_rc() or "").." BFT_Siding_B BFT_shunt_around_Track2 BFT_Mainline_Headshunt BFT_Platform1") + set_rc(F.get_rc_safe() .. table.concat(shunt_actions," ")) elseif state == "on" then - atc_send("B0WROCA1D2S4D10SM") + atc_send("I>1B0ES0;WROCA1D2S4D10SM") setstate(split_indicator,"off") - F.remove_rc({"BFT_Siding_B","BFT_shunt_around_Track2","BFT_Mainline_Headshunt","BFT_Platform1"}) + F.remove_rc(shunt_actions) end end \ No newline at end of file diff --git a/durt/nodes/(-4626,7,-6638).lua b/durt/nodes/(-4626,7,-6638).lua index 17a83e8..f602f9b 100644 --- a/durt/nodes/(-4626,7,-6638).lua +++ b/durt/nodes/(-4626,7,-6638).lua @@ -1,23 +1,19 @@ local signal = POS(-4626,7,-6616) if event.train and atc_arrow then - local rc = (get_rc() or "") - if rc:match("BFT_shunt_platforms") then + if F.has_rc("BFT_shunt_platforms") then local control = {"B0WD2A0R"} - if rc:match("BFT_shunt_Platform1") then + if F.has_rc("BFT_shunt_Platform1") then set_route(signal,"SHUNT Platform 1") control[2] = "S3CplS1" - elseif rc:match("BFT_shunt_Track2") then + elseif F.has_rc("BFT_shunt_Track2") then set_route(signal,"SHUNT Track 2") control[2] = "S3CplS1" - elseif rc:match("BFT_shunt_around_Track2") then - set_route(signal,"Around via Track2") + elseif F.has_rc("BFT_shunt_around_Track2") then + set_route(signal,"Around via Track 2") control[2] = "S4" end - - if #control > 1 then - control[1] = table.concat(control,"") - end - atc_send(control[1]) + control = table.concat(control,"") + atc_send(control) return end end \ No newline at end of file -- cgit v1.2.3