summaryrefslogtreecommitdiff
path: root/durt/nodes/(-3588,8,-2277).lua
blob: 0858265efdf91585e2ee38cd29f1c91f772c3438 (plain)
1
--train splitter track
mainline_line = "Maverick2797_diamonds"
mainline_rc = "autorun FREIGHT"
text_outside = "DURT Logs to Diamonds Conversion Train"
loading_stopper_sig = POS(-3594,9,-2277)
split_around = function()
	if ((atc_speed==0) and can_set_route(loading_stopper_sig,"Shunt Around Via Loop")) then
		split_at_index(2,"")
		atc_send("S4")
		set_route(loading_stopper_sig,"Shunt Around Via Loop")
		return
	else
		interrupt(2,"split_around")
		return
	end
end

if event.train then
	if not atc_arrow then atc_send("B1S1") return end
	if get_rc() == "split_around" then
		atc_send("B0")
		split_around()
		return
	else --rejoined from splitting or arriving train
		atc_send("B0S0WD2RS1")
		set_line(mainline_line)
		set_rc(mainline_rc)
		atc_set_text_outside(text_outside)
		atc_set_text_inside("Loading Cargo")
		return
	end
end

if event.type=="int" then
	if event.message=="split_around" then split_around() return end
	return
end