diff options
Diffstat (limited to 'Tyard/nodes/(-4027,12,-2731).lua')
-rw-r--r-- | Tyard/nodes/(-4027,12,-2731).lua | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/Tyard/nodes/(-4027,12,-2731).lua b/Tyard/nodes/(-4027,12,-2731).lua index b04ffad..2b91223 100644 --- a/Tyard/nodes/(-4027,12,-2731).lua +++ b/Tyard/nodes/(-4027,12,-2731).lua @@ -1 +1,35 @@ ---South pickup splitter
local dir = "S"
local lane = 0
--nothing below this line should indicate a hard direction
--should be able to convert to function using only above args
--------------------------------------------------
if S.yard_active then
if atc_arrow then
if S.dir == dir then
set_route("TY"..dir.."_"..lane, "HEADSHUNT")
local plen = train_length()
local rc = split_at_fc("B0")
local trc = "TY"..dir.."_"..rc
if plen == train_length() and (rc == "" or S.rc:match(trc)) then
S.exiting = true
end
if rc and rc ~= "" then
set_rc("TY"..dir.."_"..rc)
else
set_rc(S.rc)
S.exiting = true
end
else -- if S.dir ~= dir
if S.RTS then -- loop around to other HS
S.RTS = nil
set_route("TY"..dir.."_"..lane,"AROUND")
split_off_locomotive("B0")
set_rc("AROUND_"..S.dir)
return
else
atc_send("B0WRS4")
end
end
end -- nothing to do if train goes against arrow
end
\ No newline at end of file +-- Classification track +local this_dir = false -- true = F.dir arrow points north +if F.yard_active() then + if atc_arrow then -- train is at working end + if F.has_rc("TY_arrive") then --first pass + 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 + split_off_locomotive("A0B0") + atc_set_ars_disable(false) + return + end + 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 + end + else --bounce train back towards working end + 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 + set_autocouple() + end +end
\ No newline at end of file |