summaryrefslogtreecommitdiff
path: root/Tyard/nodes/(-4051,12,-2731).lua
blob: aad764924ba27f26c352f1faa54ab47b5cfca043 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--EOL code
local this_dir = false -- true = F.dir arrow points north

if not F.yard_active() then return end
if atc_arrow then
	if F.dir() == this_dir then --train has bounced and needs to leave the rake or depart with it
		if F.has_rc("TY_LAST_CLASS") then -- take the whole rake to the exit
			F.remove_rc({"TY_LAST_CLASS"})
			F.add_rc({"TY_DEPART"})
			split_off_locomotive("A0B0")
		elseif not F.has_rc("TY_FINAL_COLLECT") then
			-- disconnect loco and return to pickup
			split_off_locomotive("A0B0")
			F.add_rc({"TY_PICKUP"})
		end --if has FINAL_COLLECT then don't split off the loco. take the full rake
		F.add_rc({"TY_HEADSHUNT"})
	else --train needs to bounce
		atc_send("B0WRD1S4")
	end
else
	if F.dir() == this_dir then
		--train is clasifying wagons, let it pass and couple to the rest of the rake
		F.remove_rc_match("TY_CLASS_%S+")
	else --this should never come into play as it means the train has entered from the wrong end somehow
		atc_send("BBOL") --stop the train and open the doors (if available) to signify assistance required
		F.error(true)
	end
end