-- Classification track local this_dir = true -- 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