-- Yard arrival checker
-- F.dir = true if entering from south

if F.has_rc("TY_NOSHUNT") then return end

local function enter_yard()
	F.dir(true)
	F.yard_active(true)
	F.add_rc({"TY_ARRIVE"})
	atc_set_ars_disable(false)
	atc_send("S6")
	return
end

__approach_callback_mode = 1
if event.approach and not event.has_entered then
	atc_set_ars_disable(true)
	atc_set_lzb_tsr(1)
	return
end

if event.train then
	if F.yard_active() then
		schedule_in(";10","recheck")
		return
	else
		enter_yard()
	end		
end

if event.schedule then
	if F.yard_active() then
		schedule_in(";10","recheck")
		return
	else
		enter_yard()
	end
end