summaryrefslogtreecommitdiff
path: root/Tyard/nodes/(-4027,12,-2731).lua
blob: b04ffadc73accd695ab8a9f0f7d02893af473271 (plain)
1
--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