# Segnale alto di manovra accoppiato come avviso al segnale successivo
# (normale o comune); si apre solo quando il suo è in shunt.
#
# Aspetti: - (stop), | (on), spento (off)

# Shunting signal (tall) acting as a distant of the main signal that follows
# (normal or shared); it's clear only when its signal is clear for shunting.
#
# Aspects: | (stop), - (on), off

# P.Rosati  21/01/2021 (Versione 5.1)

Aspect: stop
	IconE: SM_=_E.xpm
	IconW: SM_=_W.xpm
	IconN: SM_=_N.xpm
	IconS: SM_=_S.xpm
	Action: none

Aspect: on
	IconE: SM_!_E.xpm
	IconW: SM_!_W.xpm
	IconN: SM_!_N.xpm
	IconS: SM_!_S.xpm
	Action: none

Aspect: off
	IconE: SM_+_E.xpm
	IconW: SM_+_W.xpm
	IconN: SM_+_N.xpm
	IconS: SM_+_S.xpm
	Action: none

# initial aspect

OnInit:
	.aspect = stop
end

# the player or a script cleared the signal

OnCleared:
	return
end

# this or another signal changed its aspect

OnUpdate:
	if .nextApproach.script > "rfi_com" and .nextApproach.script < "rfi_con"
		if nextApproach.aspect = shunt
			.aspect = on
			if nextApproach.next.script > "rfi_LL" and nextApproach.next.script < "rfi_LN"
				return
			end
		else
			.aspect = stop
		end
		if nextApproach.aspect = disabled or nextApproach.aspect = off
			.aspect = off
		end
	else
		if next.aspect = shunt
			.aspect = on
			if next.next.script > "rfi_LL" and next.next.script < "rfi_LN"
				return
			end
		else
			.aspect = stop
		end
		if next.aspect = disabled or next.aspect = off
			.aspect = off
		end
	end
end

# a train passed the signal

OnCross:
	return
end
