summaryrefslogtreecommitdiff
path: root/durt/nodes/(-1973,16,800).lua
blob: e6166e8f7e4f898e12b0402e3e846e00a080deac (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
local notification_id = "ARC"
local ind = POS(-1954,16,840)
local print_notification = true
local sections ={
	store_4 = "032832" -- Destined for Arcadius Basement Loading Dock
}
local function send_train()
	atc_send("S0WRD2A1S4")
	local cmd = { -- collect wagons from BYARD, and park loco in loco siding if no departures at ARC
		"FREIGHT",
		"ARC_LOCOSTORE",
		"ARC_AUTO",
		"ARC_RTS",
		"ARC_COLLECT_ARC_SB",
		"ARC_AUTO_S23S",
		"S23E3N",
		"BYARD",
		"BY_RTS",
		"BY_COLLECT_ARC",
		"E3S23N",
		"ARC_LIGHT_EXIT"
	}
	if #section_occupancy(sections.store_4) ~= 0 then
		if print_notification then print(rwt.to_string(rwt.now()).. " "..notification_id.." send_train() has local job from STORE_4") end
		-- perform local job to Arcadius Basement Loading Dock before taking wagons to BYARD
		cmd = {
		"FREIGHT", --because it's freight
		"ARC_LOCOSTORE", --technically the loco identifier until we have wagon ID. will be ignored by yard_headshunt because no "ARC_DEPART" etc
		"ARC_YARD_REENTRY", --redirect back into the yard from yard_exit controller. will be checked by yard_exit before ARS triggers
		"ARC_RTS", --basic yard call
		"ARC_COLLECT_ARC_LOAD_DOCK", -- collect req wagons. can be left in place, if train_length == 1 then will return to siding anyway
		"ARC_AUTO_LOCAL_LOADING", --direct to ARC Basement Loading Dock
		"ARC_LOAD", --trigger the loading track
		}
	end
	set_rc(table.concat(cmd," "))
	atc_send("S0WRD2A1S4")
	F.indicator(ind,false) -- will be reenabled by returning the wagons from the local job
end
if event.ext_int then
	if event.message == "notify" then
		if print_notification then print(rwt.to_string(rwt.now()).. " "..notification_id.." RX Notification") end
		if F.indicator(ind) then return end
		if atc_id then
			send_train()
			return
		else
			F.indicator(ind,true)
			return
		end
	end
	if event.message == "notify_local" then
		if print_notification then print(rwt.to_string(rwt.now()).. " "..notification_id.." RX Notification - Local Job") end
		if F.indicator(ind) then return end
		if atc_id then
			send_train()
			return
		else
			F.indicator(ind,true)
			return
		end
	end
end
if event.train then
	if F.indicator(ind) then
		send_train()
		return
	end
	atc_send("B0")
	return
end