diff --git a/src/Devices/AtcBombardier.cs b/src/Devices/AtcBombardier.cs index 46795d8..6bf3766 100644 --- a/src/Devices/AtcBombardier.cs +++ b/src/Devices/AtcBombardier.cs @@ -46,25 +46,25 @@ namespace OpenbveFcmbTrainPlugin private AtcControlStates AtcControlState; /// The time needed by the ATC device to initialize, in seconds. - private double InitializationTime = 30; + private double InitializationTime; /// A counter to keep track of initialization time, in seconds. private double InitializationCounter; /// The blinking time for lamps, in milliseconds. - private double BlinkTime = 500; + private double BlinkTime; /// A counter to keep track of blink time, in milliseconds. private double BlinkCounter; /// The time after which YARD mode enters idle state and engages the service brake, in seconds. - private double YardIdleTime = 60; + private double YardIdleTime; /// A counter to keep track of YARD mode idle time, in seconds. private double YardIdleCounter; - /// The maximum speed in YARD mode. - private double YardMaximumSpeed = 20; + /// The maximum speed in YARD mode, in km/h. + private double YardMaximumSpeed; /// Represents an ATC movement permission order. private class MovementPermission @@ -96,6 +96,18 @@ namespace OpenbveFcmbTrainPlugin /// The ideal brake notch for the AI. private int AiBrakeNotch; + /// Creates an instance of the Bombardier ATC device. + /// The time needed by the ATC device to initialize, in seconds. + /// The time after which YARD mode enters idle state and engages the service brake, in seconds. + /// The maximum speed in YARD mode, in km/h. + /// The blinking time for lamps, in milliseconds. + internal AtcBombardier(double initTime, double yardIdleTime, double yardMaxSpeed, double blinkTime) + { + InitializationTime = initTime; + YardIdleTime = yardIdleTime; + YardMaximumSpeed = yardMaxSpeed; + BlinkTime = blinkTime; + } /// Is called when the device state should be updated. /// The current train. diff --git a/src/Devices/Deadman.cs b/src/Devices/Deadman.cs index d7a7e8a..13cb93a 100644 --- a/src/Devices/Deadman.cs +++ b/src/Devices/Deadman.cs @@ -27,7 +27,16 @@ namespace OpenbveFcmbTrainPlugin private double BrakeDelay = 5.0; /// Whether the train must be completely stopped to release the brakes. - private bool FullReset = false; + private bool FullReset; + + /// Creates an instance of the Deadman device. + /// The delay before the brakes are applied, in seconds. + /// Whether the train must be completely stopped to release the brakes. + internal Deadman(double brakeDelay, bool fullReset) + { + BrakeDelay = brakeDelay; + FullReset = fullReset; + } /// Is called when the device state should be updated. /// The current train. diff --git a/src/Devices/Doors.cs b/src/Devices/Doors.cs index d943dca..12312e1 100644 --- a/src/Devices/Doors.cs +++ b/src/Devices/Doors.cs @@ -16,10 +16,10 @@ namespace OpenbveFcmbTrainPlugin private bool RequireDoorClosingSound; /// The duration of the door closing sound, in seconds. - private double DoorClosingSoundDuration = 5; + private double DoorClosingSoundDuration; /// The timeout after which the door closing sound needs to be played again, in seconds. - private double DoorClosingSoundTimeout = 15; + private double DoorClosingSoundTimeout; /// The counter for the door closing sound. private double DoorClosingSoundCounter; @@ -33,14 +33,8 @@ namespace OpenbveFcmbTrainPlugin /// Whether the AI should trigger the door closing sound. private bool AiTriggerDoorClosingSound; - /// The timeout after which the AI needs to close doors if they become stuck, in seconds. - private double AiDoorStuckTimeout = 10; - - /// The counter for the AI to close doors if they become stuck. - private double AiDoorStuckCounter; - /// The index of the door closing sound. - private int DoorClosingSoundIndex = 10; + private int DoorClosingSoundIndex; /// The current time. private Time CurrentTime = new Time(0); @@ -48,6 +42,18 @@ namespace OpenbveFcmbTrainPlugin /// The time when the doors last opened. private Time DoorOpenTime = new Time(0); + /// Whether the door closing sound is required to be played to close the doors. + /// The delay before the brakes are applied, in seconds. + /// The duration of the door closing sound, in seconds. + /// The timeout after which the door closing sound needs to be played again, in seconds. + /// The index of the door closing sound. + internal Doors(bool requireClosingSound, double closingSoundDuration, double closingSoundTimeout, int closingSoundIndex) + { + RequireDoorClosingSound = requireClosingSound; + DoorClosingSoundDuration = closingSoundDuration; + DoorClosingSoundTimeout = closingSoundTimeout; + DoorClosingSoundIndex = closingSoundIndex; + } /// Is called when the device state should be updated. /// The current train. diff --git a/src/Train/Train.cs b/src/Train/Train.cs index 4f44b82..1809cf7 100644 --- a/src/Train/Train.cs +++ b/src/Train/Train.cs @@ -66,10 +66,10 @@ namespace OpenbveFcmbTrainPlugin Panel = panel; PhysicalHandles = new DriverHandles(); Devices = new List(); - Devices.Add(new Doors()); - Devices.Add(new Deadman()); + Devices.Add(new Doors(false, 5, 15, 10)); + Devices.Add(new Deadman(5.0, false)); Devices.Add(new TrainStop()); - Devices.Add(new AtcBombardier()); + Devices.Add(new AtcBombardier(30, 60, 20, 500)); } /// Is called when the train should initialize.