summaryrefslogtreecommitdiff
path: root/Tyard/nodes/(-4027,12,-2655).lua
diff options
context:
space:
mode:
Diffstat (limited to 'Tyard/nodes/(-4027,12,-2655).lua')
-rw-r--r--Tyard/nodes/(-4027,12,-2655).lua30
1 files changed, 17 insertions, 13 deletions
diff --git a/Tyard/nodes/(-4027,12,-2655).lua b/Tyard/nodes/(-4027,12,-2655).lua
index 136f70b..c090df1 100644
--- a/Tyard/nodes/(-4027,12,-2655).lua
+++ b/Tyard/nodes/(-4027,12,-2655).lua
@@ -1,32 +1,36 @@
-- Classification track
-local this_dir = true -- true = F.dir arrow points north
+local this_dir = true -- F.dir arrow points north then this is true
if F.yard_active() then
- if atc_arrow then -- train is at working end
- if F.has_rc("TY_arrive") then --first pass
+ 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
if F.has_rc("TY_RTS") then
F.dir(not F.dir())
F.remove_rc({"TY_RTS"})
- F.add_rc({"TY_AROUND","TY_WYE"}) --need to add direction selection in the southern headshunt controller
+ F.add_rc({"TY_AROUND"}) -- send loco around to the other end
split_off_locomotive("A0B0")
atc_set_ars_disable(false)
return
end
- F.remove_rc({"TY_arrive"})
- step_fc()
+ F.remove_rc({"TY_ARRIVE"})
+ step_fc()
end
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 --> local remove = {} for v in F.get_rc_safe():gmatch("(TY_CLASS_*)") do table.insert(remove,v) end F.remove_rc(remove)
- atc_set_ars_disable(false)
- else
- F.add_rc({"TY_DEPART"})
- atc_set_ars_disable(false)
- --send train to collect relevant wagon group and depart
+ 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
+ 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
+ atc_set_ars_disable(false)
else --bounce train back towards working end
- atc_send("S0WRD1S3")
+ atc_send("S0WRD1S3A1")
unset_autocouple()
end
else -- train entering from the far end. set autocouple so it pushes all the way through to the bounce