File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 1818using ORTS . Common ;
1919using System ;
2020using System . Collections . Generic ;
21+ using ORTS . Scripting . Api ;
2122
2223namespace Orts . Simulation . RollingStocks . SubSystems . Brakes . MSTS
2324{
@@ -33,7 +34,9 @@ public EPBrakeSystem(TrainCar car)
3334 public override void Update ( float elapsedClockSeconds )
3435 {
3536 MSTSLocomotive lead = ( MSTSLocomotive ) Car . Train . LeadLocomotive ;
36- if ( lead != null && lead . BrakeSystem is EPBrakeSystem )
37+
38+ // Only allow brakes to operate if car is connected to an SME system
39+ if ( lead != null && lead . BrakeSystem is EPBrakeSystem && Car . BrakeSystem is EPBrakeSystem && ( lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . EPFullServ || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . EPOnly || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . EPApply ) )
3740 {
3841
3942 float demandedAutoCylPressurePSI = 0 ;
Original file line number Diff line number Diff line change 1818using ORTS . Common ;
1919using System ;
2020using System . Collections . Generic ;
21+ using ORTS . Scripting . Api ;
2122
2223namespace Orts . Simulation . RollingStocks . SubSystems . Brakes . MSTS
2324{
@@ -33,7 +34,9 @@ public SMEBrakeSystem(TrainCar car)
3334 public override void Update ( float elapsedClockSeconds )
3435 {
3536 MSTSLocomotive lead = ( MSTSLocomotive ) Car . Train . LeadLocomotive ;
36- if ( lead != null && lead . BrakeSystem is SMEBrakeSystem )
37+
38+ // Only allow brakes to operate if car is connected to an SME system
39+ if ( lead != null && lead . BrakeSystem is SMEBrakeSystem && Car . BrakeSystem is SMEBrakeSystem && ( lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . SMEFullServ || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . SMEOnly || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . SMEReleaseStart || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . SMESelfLap ) )
3740 {
3841
3942 float demandedAutoCylPressurePSI = 0 ;
You can’t perform that action at this time.
0 commit comments