summaryrefslogtreecommitdiff
path: root/auto_yards/nodes/(-2029,19,733).lua
blob: 58ed28c8f839ffea31c6ea06b204a7c7f4b128b6 (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
29
30
31
32
33
34
local yard_id = "ARC"
if event.train then

	-- direct train to the headshunt to reenter the yard
    if F.has_rc("ARC_YARD_REENTRY") then
        -- loco will use S23-S approach track as headshunt and re-enter yard
        -- RC will be removed by the headshunt controller (req to trigger it)
        -- manually set the route here before ARS has a chance
        set_route(POS(-2033,21,731),"Yard Reentry (LENGTH LIMIT)")
        -- defer re-enabling ARS to ensure the route has been accepted, if not set
        atc_send("S4D1A1")
        return
    end

	-- deal with ARC_2nd_EXIT_rc
	local rc = F.get_rc_safe():match("ARC_2ND_EXIT_(%S+)")
	print(rc)
	if rc then
		F.remove_rc_match("ARC_2ND_EXIT_%S+")
		F.add_rc(rc)
		print(F.get_rc_safe())
        atc_set_ars_disable(false)
        atc_send("SM")
		return
	end
	-- disregard light exit locos
    if F.has_rc(yard_id.."_LIGHT_EXIT") then
        F.remove_rc(yard_id.."_LIGHT_EXIT")
        atc_set_ars_disable(false)
        atc_send("SM")
        return
    end
end
F.headshunt_exit(yard_id,true)