I am using Mark Brinton's SR LoS boards, which are track linked. Is there any way in which I can penalise a player who makes a shunt movement beyond a board?
Nick
function Initialise ()
Call( "Set2DMapSignalState", BLOCKED )
end
-- Send SPAD message to anyone passing any link (i.e., the only link) in forward direction
function OnConsistPass ( prevFrontDist, prevBackDist, frontDist, backDist, linkIndex )
if (prevFrontDist > 0 and frontDist <= 0) then
Call( "SendConsistMessage", SPAD_MESSAGE, "" )
end
end
-- Update is never called but better have it defined.
function Update (time)
end
-- Relay any message - more important than one thinks
function OnSignalMessage( message, parameter, direction, linkIndex )
if parameter ~= "DoNotForward" and message ~= RESET_SIGNAL_STATE then
Call( "SendSignalMessage", message, parameter, -direction, 1, linkIndex )
end
end
function OnConsistPass ( prevFrontDist, prevBackDist, frontDist, backDist, linkIndex )
-- Send SPAD message to anyone passing any link (i.e., the only link) in forward direction
if (prevFrontDist > 0 and frontDist <= 0) then
Call( "SendConsistMessage", SPAD_MESSAGE, "" )
end
-- Send overspeed message to anyone approaching this signal within 100 m at more than 15 mph
if (prevFrontDist > frontDist and frontDist < 100) then
local consistSpeed = Call("GetConsistSpeed") / 1609 * 3600
if consistSpeed > 15 then
Call("SendConsistMessage", TPWS_MESSAGE, "overspeed")
end
end
end
Users browsing this forum: No registered users and 1 guest