summaryrefslogtreecommitdiff
path: root/Tyard/nodes/(-4012,12,-2646).lua
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-04-22 14:56:58 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-04-22 14:56:58 +0200
commit4590cc6504d625404f0af394da41bb71fc2dec45 (patch)
treebc8ae688454d7254909feb05e87d46fb4241bea2 /Tyard/nodes/(-4012,12,-2646).lua
parentaeea70df13db7d77ce2ce1075cbd14dc1c3797fc (diff)
downloadluaatc_envs-4590cc6504d625404f0af394da41bb71fc2dec45.tar.gz
luaatc_envs-4590cc6504d625404f0af394da41bb71fc2dec45.tar.bz2
luaatc_envs-4590cc6504d625404f0af394da41bb71fc2dec45.zip
State at 2022-04-20
Diffstat (limited to 'Tyard/nodes/(-4012,12,-2646).lua')
-rw-r--r--Tyard/nodes/(-4012,12,-2646).lua46
1 files changed, 45 insertions, 1 deletions
diff --git a/Tyard/nodes/(-4012,12,-2646).lua b/Tyard/nodes/(-4012,12,-2646).lua
index 5199847..751506b 100644
--- a/Tyard/nodes/(-4012,12,-2646).lua
+++ b/Tyard/nodes/(-4012,12,-2646).lua
@@ -1 +1,45 @@
--- Headshunt / Exit controller \ No newline at end of file
+-- Headshunt Controller
+-- Note: may need customising due to track layout
+local this_dir = true -- true = F.dir arrow points north. atc_arrow points towards yard
+local error_indicator = POS(-4025,13,-2671)
+__approach_callback_mode = 1
+if event.approach and not event.has_entered then
+ atc_set_ars_disable(true)
+ atc_set_lzb_tsr(1)
+ return
+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
+ else --train has bounced
+ if F.has_rc("TY_AROUND") then
+ if this_dir = F.dir() then --send train to Classification
+ F.remove_rc({"TY_AROUND"})
+ F.add_rc({"TY_PICKUP"})
+ atc_set_ars_disable(false)
+ return
+ 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
+ end
+ return
+end
+
+if event.schedule then
+ if not atc_id then --bounce the train that just passed
+ atc_send_to_train(event.msg,"S0WRD1S3")
+ else
+ if atc_id == event.msg then --train hasn't fully passed yet, wait a bit longer
+ schedule_in(";01",atc_id)
+ else -- somehow another train crossed the controller before the first one returned. Unlikely but possible
+ atc_send_to_train(event.msg,"BBOL")
+ atc_send("BBOL")
+ F.error(true)
+ end
+ end
+ return
+end \ No newline at end of file