summaryrefslogtreecommitdiff
path: root/Tyard/nodes/(-4100,12,-2742).lua
diff options
context:
space:
mode:
Diffstat (limited to 'Tyard/nodes/(-4100,12,-2742).lua')
-rw-r--r--Tyard/nodes/(-4100,12,-2742).lua23
1 files changed, 17 insertions, 6 deletions
diff --git a/Tyard/nodes/(-4100,12,-2742).lua b/Tyard/nodes/(-4100,12,-2742).lua
index 1fc57ae..37b303a 100644
--- a/Tyard/nodes/(-4100,12,-2742).lua
+++ b/Tyard/nodes/(-4100,12,-2742).lua
@@ -13,11 +13,23 @@ end
if event.train then
if not atc_arrow then --train has entered headshunt from yard. bounce or depart
- if not F.has_rc("TY_DEPART") then --if has TY_DEPART then another controller closer to the signal will remove to ensure signal engages the RC
- schedule_in(";01",atc_id)
- atc_set_ars_disable(true)
- return
- end
+ atc_set_ars_disable(true)
+ F.remove_rc({"TY_HEADSHUNT"})
+ if not F.has_rc("TY_FINAL_COLLECT") then
+ if not F.has_rc("TY_DEPART") then
+ schedule_in(";01",atc_id)
+ return
+ else
+ local collect = F.get_rc_safe():match("TY_COLLECT_(%S+)")
+ if collect then --train needs to collect a rake from the yard before departing
+ F.add_rc({"TY_FINAL_COLLECT","TY_CLASS_"..collect})
+ schedule_in(";01",atc_id)
+ return
+ end
+ end
+
+ --else let train proceed forward to the exit controller without a rake
+ end --else train has already collected rake. let it exit yard
else --train has bounced
if F.has_rc("TY_AROUND") then
if this_dir == F.dir() then --send train to Classification
@@ -28,7 +40,6 @@ if event.train then
end --if at wrong end, do nothing. train will follow TY_AROUND ARS to relevant headshunt
end -- if doesn't have TY_AROUND then let ARS classify the train
- F.remove_rc({"TY_HEADSHUNT"})
atc_set_ars_disable(false)
end
return