# Segnale di avviso fittizio da nascondere e collegare prima di un segnale
# di protezione per far suonare la Leopolder quando quest'ultimo si apre.
#
# Aspetti: nothing (non fa nulla), sound (suona se prima era nothing)

# Special pure distant to be placed hidden before a home signal; it plays a sound
# (a well known ringbell called 'Leopolder') whenever the next signal is cleared.
#
# Aspects: nothing   (do nothing, next signal is not clear)
#          sound     (play sound if previuos aspect was nothing)

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

Aspect: nothing
	IconE: NN_b_E.xpm
	IconW: NN_b_W.xpm
	IconN: NN_b_N.xpm
	IconS: NN_b_S.xpm
	Action: none

Aspect: sound
	IconE: NN_b_E.xpm
	IconW: NN_b_W.xpm
	IconN: NN_b_N.xpm
	IconS: NN_b_S.xpm
	Action: none

# initial aspect

OnInit:
	.aspect = nothing
end

# the player or a script cleared the signal

OnCleared:
	return
end

# this or another signal changed its aspect

OnUpdate:
	if nextApproach.script > "rfi" or next.script > "rfi"	# Se segue un segnale... - If a signal follows...
		if next.aspect = red or next.aspect = shunt or next.color = white or next.aspect = off or next.aspect = disabled or next.aspect = fault
			.aspect = nothing
		else							# Il segnale si sta aprendo normalmente - Next signal is clearing normally
			if .aspect = nothing
				do play leopolder
			end
			.aspect = sound
		end
	end
end

# a train passed the signal

OnCross:
	return
end
