summaryrefslogtreecommitdiff
path: root/Tyard/nodes/(-4027,12,-2731).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
commit10f12bff0f9191133e8c10c1754c5642e9b1f5b8 (patch)
tree723c0812b04a4a03626204369cd750c9c79c89f3 /Tyard/nodes/(-4027,12,-2731).lua
parent7ce1ee32c9dd199eef6212c4f601ac4aaf3ce400 (diff)
downloadluaatc_envs-10f12bff0f9191133e8c10c1754c5642e9b1f5b8.tar.gz
luaatc_envs-10f12bff0f9191133e8c10c1754c5642e9b1f5b8.tar.bz2
luaatc_envs-10f12bff0f9191133e8c10c1754c5642e9b1f5b8.zip
State at 2022-04-22
Diffstat (limited to 'Tyard/nodes/(-4027,12,-2731).lua')
-rw-r--r--Tyard/nodes/(-4027,12,-2731).lua23
1 files changed, 15 insertions, 8 deletions
diff --git a/Tyard/nodes/(-4027,12,-2731).lua b/Tyard/nodes/(-4027,12,-2731).lua
index 9968850..e703257 100644
--- a/Tyard/nodes/(-4027,12,-2731).lua
+++ b/Tyard/nodes/(-4027,12,-2731).lua
@@ -1,13 +1,15 @@
-- Classification track
-local this_dir = false -- F.dir arrow points north then this is true
+local this_dir = false
+-- this_dir == true for north end, false for south end
if F.yard_active() then
if atc_arrow then -- loco is at working end
F.remove_rc({"TY_PICKUP"})
if F.has_rc("TY_ARRIVE") then --first pass, prep train for working
+ F.remove_rc({"TY_AROUND"})
if F.has_rc("TY_RTS") then
F.dir(not F.dir())
F.remove_rc({"TY_RTS"})
- F.add_rc({"TY_AROUND"}) -- send loco around to the other end
+ F.add_rc({"TY_HEADSHUNT","TY_AROUND"}) -- send loco around to the other end
split_off_locomotive("A0B0")
atc_set_ars_disable(false)
return
@@ -15,23 +17,28 @@ if F.yard_active() then
F.remove_rc({"TY_ARRIVE"})
step_fc()
end
- if this_dir = F.dir() then --train has bounced and is ready to classify wagon(s)
+ if this_dir == F.dir() then --train has bounced and is ready to classify wagon(s)
local t_len = train_length()
local lane = split_at_fc("A0B0",3)
if t_len ~= train_length() then -- train still has wagons to classify
F.add_rc({"TY_CLASS_"..lane}) -- to be pattern matched when leaving lane
else -- train_length is the same as it was before it tried to split_at_fc, hence it's just the loco
- local collect = F.get_rc_safe():match("TY_COLLECT_(%S+)")
- if not collect then
- F.add_rc({"TY_DEPART"}) -- run engines-light to the exit, we're not collecting anything
+ if not F.has_rc("TY_LAST_CLASS") then
+ F.add_rc({"TY_CLASS_"..lane,"TY_LAST_CLASS"})
else
- F.add_rc({"TY_FINAL_COLLECT","TY_CLASS_"..collect}) --loco is to collect lane before departing. TY_DEPART to be set by EOL
+ local collect = F.get_rc_safe():match("TY_COLLECT_(%S+)")
+ if not collect then
+ F.add_rc({"TY_DEPART"}) -- run engines-light to the exit, we're not collecting anything
+ else
+ F.add_rc({"TY_FINAL_COLLECT","TY_CLASS_"..collect}) --loco is to collect lane before departing. TY_DEPART to be set by EOL
+ end
end
end
F.add_rc({"TY_HEADSHUNT"})
atc_set_ars_disable(false)
+ set_autocouple()
else --bounce train back towards working end
- atc_send("S0WRD1S3A1")
+ atc_send("S0WRD1S3")
unset_autocouple()
end
else -- train entering from the far end. set autocouple so it pushes all the way through to the bounce