From 2d065ce9bedc6c7c0740a9148e96463749f8bf24 Mon Sep 17 00:00:00 2001 From: autocommitter Date: Fri, 1 Nov 2024 00:00:01 +0100 Subject: State at 2024-11-01 --- durt/nodes/(-1403,11,-2533).lua | 51 ++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 31 deletions(-) (limited to 'durt/nodes/(-1403,11,-2533).lua') diff --git a/durt/nodes/(-1403,11,-2533).lua b/durt/nodes/(-1403,11,-2533).lua index 898b856..e6f76db 100644 --- a/durt/nodes/(-1403,11,-2533).lua +++ b/durt/nodes/(-1403,11,-2533).lua @@ -1,6 +1,8 @@ -local rev_rc = "S27_REV_East" -local rm_rc = false - +-- Automatic bouncer for headshunts, assuming longer headshunt than train length. Arrow points into headshunt +local rev_rc = "S27_EXP_HS_N" +local rm_rc = true +local autocouple = "S27_EXP_HS_N_AC" +local rm_cpl_rc = true __approach_callback_mode = 1 @@ -10,38 +12,25 @@ if event.approach and not event.has_entered then return end -if event.train and atc_arrow then - if not F.has_rc(rev_rc) then - atc_set_ars_disable(false) +if event.train then + if not atc_arrow then --train has bounced + if F.has_rc("S27_EXPORT_ACTIVE") and not F.has_rc("S27_EXPORT_FINAL") then + if not section_occupancy("254098")[1] then --no more train to shuffle + F.add_rc("S27_EXPORT_FINAL") + end + end + if F.has_rc(autocouple) then + atc_send("CplS0WD2S1") + if rm_cpl_rc then F.remove_rc({autocouple}) end + end return end - if rm_rc then F.remove_rc({rev_rc}) end - if F.has_rc("S27_SHUNTER") then - local stages = { - "S27_EXP_PICKUP", - "S27_EXP_LOAD", - "S27_EXP_DEPART" - } - - for i,v in ipairs(stages) do - if F.has_rc(v) then - unset_autocouple() - F.remove_rc(v) - local next_stage = stages[i == #stages and 1 or i+1] - if next_stage == "S27_EXP_PICKUP" and not section_occupancy("254098")[1] then -- no wagons left to load. store loco - F.add_rc("S27_LOCOSTORE") - break - end - if next_stage ~= "S27_EXP_DEPART" then - set_autocouple() - end - F.add_rc(next_stage) - - break - end - end + if not F.has_rc(rev_rc) then --not our train. disregard + atc_set_ars_disable(false) + return end + if rm_rc then F.remove_rc({rev_rc}) end schedule_in(";01",atc_id) return end -- cgit v1.2.3