summaryrefslogtreecommitdiff
path: root/durt/nodes/(-716,3,1894).lua
blob: 7345c4a3d79eb756c1396087ea14bb1c10d81a47 (plain)
1
2
3
4
if event then return end
--temporarily disable the track
-------------------------------------------------------------------------------------------
factory_exit_sig = "icebreaker_factory_exit"
inside_maniest = "Cargo: Empty\nOrigin: Icebreaker Factory\nDestination: Auto Plantation"
outside_naming = "DURT Logs to Diamond Conversion Train"
mainline_rc = "autorun FREIGHT"
mainline_ln = "Maverick2797_diamonds"

if event.train then
	digiline_send("train_response","Train "..atc_id.." ready||Entered factory:||Speed: "..atc_speed)
	set_line(mainline_ln)
	set_rc(mainline_rc)
	atc_set_text_outside(outside_naming)
	atc_set_text_inside(inside_maniest)
end

if event.digiline then
	if event.channel=="train_control" then
		if not atc_id then
			digiline_send("train_response","No Train Detected")
			return
		end
		if event.msg=="shuffle" then
			if atc_speed > 0 then
				digiline_send("train_response","Please wait:||train still moving||Speed: "..atc_speed)
				return
			elseif not can_set_route(factory_exit_sig,"Reverse to Breaker-side Siding") then
				digiline_send("train_response","Unable to set route to:||Breaker-side Siding")
				return
			else
				set_route(factory_exit_sig,"Reverse to Breaker-side Siding")
				atc_send("R S1 D5 SM D13 S0 W R S1")
				digiline_send("train_response","Refilling Input Chests||Shuffling Train")
				return
			end
			return
		elseif event.msg=="exit" then
			if atc_speed > 0 then
				digiline_send("train_response","Please wait:||train still moving||Speed: "..atc_speed)
				return
			elseif not can_set_route(factory_exit_sig,"Exit to Mainline South") then
				digiline_send("train_response","Unable to set route to:||Mainline South")
				return
			else
				set_route(factory_exit_sig,"Exit to Mainline South")
				atc_send("R SM")
				digiline_send("train_response","Train Departing")
				return
			end
			return
		elseif event.msg=="rehead" then
			if atc_speed > 0 then
				digiline_send("train_response","Please wait:||train still moving||Speed: "..atc_speed)
				return
			elseif not can_set_route(factory_exit_sig,"Reverse for loco run-around") then
				digiline_send("train_response","Unable to set route to:||Loco Run Around Sequence")
				return
			else
				set_route(factory_exit_sig,"Reverse for loco run-around")
				set_rc("split_around")
				atc_send("R SM D15 S0 W R S1")
				digiline_send("train_response","Loco Changind Ends")
				return
			end
			return
		end
		return
	end
	return
end