ATC Dimetronic: mode switch
This commit is contained in:
commit
da761976b4
4 changed files with 20 additions and 8 deletions
|
@ -58,25 +58,25 @@ namespace OpenbveFcmbTrainPlugin
|
|||
private TrackStates TrackState;
|
||||
|
||||
/// <summary>The time needed by the ATC device to initialize, in seconds.</summary>
|
||||
private double InitializationTime;
|
||||
private readonly double InitializationTime;
|
||||
|
||||
/// <summary>A counter to keep track of initialization time, in seconds.</summary>
|
||||
private double InitializationCounter;
|
||||
|
||||
/// <summary>The blinking time for lamps, in milliseconds.</summary>
|
||||
private double BlinkTime;
|
||||
private readonly double BlinkTime;
|
||||
|
||||
/// <summary>A counter to keep track of blink time, in milliseconds.</summary>
|
||||
private double BlinkCounter;
|
||||
|
||||
/// <summary>The time after which YARD mode enters idle state and engages the service brake, in seconds.</summary>
|
||||
private double YardIdleTime;
|
||||
private readonly double YardIdleTime;
|
||||
|
||||
/// <summary>A counter to keep track of YARD mode idle time, in seconds.</summary>
|
||||
private double YardIdleCounter;
|
||||
|
||||
/// <summary>The maximum speed in YARD mode, in km/h.</summary>
|
||||
private double YardMaximumSpeed;
|
||||
private readonly double YardMaximumSpeed;
|
||||
|
||||
/// <summary>Represents an ATC movement permission order.</summary>
|
||||
private class MovementPermission
|
||||
|
|
|
@ -55,6 +55,7 @@ namespace OpenbveFcmbTrainPlugin
|
|||
/// <summary>Whether ATO is available or not on the train.</summary>
|
||||
private readonly bool AtoAvailable;
|
||||
|
||||
|
||||
/// <summary>Represents an ATC speed code.</summary>
|
||||
private class SpeedCode
|
||||
{
|
||||
|
|
|
@ -24,10 +24,10 @@ namespace OpenbveFcmbTrainPlugin
|
|||
private double Counter;
|
||||
|
||||
/// <summary>The delay time until the service brake is applied, in seconds.</summary>
|
||||
private double BrakeDelay = 5.0;
|
||||
private readonly double BrakeDelay = 5.0;
|
||||
|
||||
/// <summary>Whether the train must be completely stopped to release the brakes.</summary>
|
||||
private bool FullReset;
|
||||
private readonly bool FullReset;
|
||||
|
||||
/// <summary>Creates an instance of the Deadman device.</summary>
|
||||
/// <param name="brakeDelay">The delay before the brakes are applied, in seconds.</param>
|
||||
|
|
|
@ -118,11 +118,18 @@ namespace OpenbveFcmbTrainPlugin
|
|||
// Use departure time - door closing sound duration
|
||||
AiTriggerDoorClosingSound |= CurrentTime.Seconds >= route.CurrentStation.DepartureTime - DoorClosingSoundDuration;
|
||||
}
|
||||
// TODO: AI gets stuck if doors open between stations, check distance to stop point
|
||||
}
|
||||
else
|
||||
{
|
||||
AiTriggerDoorClosingSound = false;
|
||||
// The doors have been opened between stations
|
||||
if (route.CurrentStation.StopPosition - route.CurrentStation.BackwardTolerance > train.State.Location)
|
||||
{
|
||||
AiTriggerDoorClosingSound = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AiTriggerDoorClosingSound = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -166,6 +173,10 @@ namespace OpenbveFcmbTrainPlugin
|
|||
{
|
||||
DoorOpenTime = CurrentTime;
|
||||
}
|
||||
|
||||
// Set door closing counter to value higher than maximum where doors are allowed to close
|
||||
// This effectively locks the doors when they open
|
||||
DoorClosingSoundCounter = DoorClosingSoundDuration + DoorClosingSoundTimeout;
|
||||
}
|
||||
|
||||
/// <summary>Is called when the device should perform the AI.</summary>
|
||||
|
|
Loading…
Add table
Reference in a new issue