summaryrefslogtreecommitdiff
path: root/durt/nodes/(-2080,3,822).lua
blob: d450d7d7fe859592410dfd9820616bde2e46aeb5 (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
local indicator = POS(-2080,6,826)
local rc = (get_rc or "")
local shunting_rc = {"ArcLoad_split","ArcLoad_around","ArcLoad_rejoin"}

if type(rc) == "string" then rc = function() return "" end end
if rc():match("ArcLoad_NOSHUNT") then return end

if event.train and atc_arrow then
	print(get_rc())
	if getstate(indicator) == "green" then
		F.remove_rc(shunting_rc,true)
		atc_send("S0WRD1A1S2D10SM")
		setstate(indicator,"red")
		set_rc(rc().." ArcLoad_exit")
	else
		local o_text = atc_get_text_outside() or ""
		atc_set_text_outside("Waiting for Locomotive")
		split_off_locomotive("A0B0",1)
		atc_set_text_outside(o_text)
		set_rc(rc().." "..table.concat(shunting_rc," "))
		setstate(indicator,"green")
	end
	print(get_rc())
end