summaryrefslogtreecommitdiff
path: root/auto_yards/nodes/(-590,26,2504).lua
blob: 7632bd24ce57efebf202575de60455adc143f0ed (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
35
36
37
38
39
40
41
42
43
-- Cannery Dirt Loading Lane Modified
local ind = POS(-594,26,2488) --notification indicator
local sand_indicator = POS(-572,26,2515) --sand indicator

if F.has_rc("CAN_INTRA_SHUFFLE") then 
	if not atc_arrow then return end
	if F.has_rc("CAN_CLASS_DIRT_UNLOAD") then -- remove wagons, step the fc, move wagons to sand loading
		F.remove_rc("CAN_CLASS_DIRT_UNLOAD")
		F.add_rc({
			"CAN_HS_W",
			"CAN_CLASS_SAND_LOAD",
			"CAN_FROM_DIRT"
		})
		step_fc()
		return
	end
	if F.has_rc("CAN_FROM_DIRT") then --leave wagons and return to locostore, shutting down the yard as we go
		F.remove_rc({
			"CAN_CLASS_SAND_LOAD",
			"CAN_FROM_DIRT"
		})
		split_off_locomotive("A0B0")
		F.add_rc({
			"CAN_HS_W",
			"CAN_send_to_locostore"
		})
		F.indicator(sand_indicator, false) --ensure the sand indicator is off to allow the wagons to load
		F.indicator(ind,true) --re-enable the notification as we haven't actually left the yard yet
		F.indicator(S.yards.CAN.active_indicator_pos, false) -- disable the active indicator
		return
	end
	if F.has_rc("CAN_CLASS_SAND_LOAD") then -- remove wagons, step the fc, move wagons to departures
		F.remove_rc("CAN_CLASS_SAND_LOAD")
		F.add_rc({
			"CAN_HS_W", --departures track has Cpl function built in
			"CAN_CLASS_DEPARTURES"
		})
		step_fc()
		return
	end
	return
end
F.lane_EOL("CAN",true)