summaryrefslogtreecommitdiff
path: root/durt/nodes/(-4623,7,-6597).lua
blob: 4a4dcb0747654db83fde6af3cc8fe85680614d58 (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
local split_indicator = POS(-4627,8,-6597)
__approach_callback_mode = 1

local shunt_actions = {
	"BFT_Siding_B",
	"BFT_shunt_platforms",
	"BFT_shunt_around_Track2",
	"BFT_Mainline_Headshunt",
	"BFT_rejoin_from_north",
	"BFT_Platform1"
}

if event.approach and not event.has_entered then
	if F.has_rc("BFT_around_test") == false then return end
	
	atc_set_ars_disable(true)
	atc_set_lzb_tsr(1)
end

if event.train then
	if F.has_rc("BFT_around_test") == false then return end
	if not atc_arrow then return end
	local state = getstate(split_indicator)
	if state == "off" then
		split_off_locomotive("A0B0OR",1)
		atc_send("S3")
		atc_set_ars_disable(false)
		setstate(split_indicator,"on")
		set_rc(F.get_rc_safe() .." ".. table.concat(shunt_actions," "))
	elseif state == "on" then
		atc_send("I>1B0ES0;WROCA1D2S4D10SM")
		setstate(split_indicator,"off")
		F.remove_rc(shunt_actions)
	end
end