summaryrefslogtreecommitdiff
path: root/Tyard/nodes/(-4012,12,-2646).lua
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-04-22 14:57:00 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-04-22 14:57:00 +0200
commitc5162349ed82ccbde82a8f870a45e7cc5c0c5e65 (patch)
treeebaa6c281c8f6c553590db4165fcff53a748943f /Tyard/nodes/(-4012,12,-2646).lua
parent10f12bff0f9191133e8c10c1754c5642e9b1f5b8 (diff)
downloadluaatc_envs-c5162349ed82ccbde82a8f870a45e7cc5c0c5e65.tar.gz
luaatc_envs-c5162349ed82ccbde82a8f870a45e7cc5c0c5e65.tar.bz2
luaatc_envs-c5162349ed82ccbde82a8f870a45e7cc5c0c5e65.zip
State at 2022-04-23
Diffstat (limited to 'Tyard/nodes/(-4012,12,-2646).lua')
-rw-r--r--Tyard/nodes/(-4012,12,-2646).lua23
1 files changed, 17 insertions, 6 deletions
diff --git a/Tyard/nodes/(-4012,12,-2646).lua b/Tyard/nodes/(-4012,12,-2646).lua
index aa2cbfe..670bb6c 100644
--- a/Tyard/nodes/(-4012,12,-2646).lua
+++ b/Tyard/nodes/(-4012,12,-2646).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