@@ -143,6 +143,8 @@ public enum SoundState
143143 public bool CabRadioOn ;
144144 public bool OnLineCabRadio ;
145145 public string OnLineCabRadioURL ;
146+ public bool Battery ;
147+ public bool PowerKey ;
146148
147149 // Water trough filling
148150 public bool HasWaterScoop = false ; // indicates whether loco + tender have a water scoop or not
@@ -1103,6 +1105,8 @@ public override void Save(BinaryWriter outf)
11031105 ControllerFactory . Save ( SteamHeatController , outf ) ;
11041106 outf . Write ( AcceptMUSignals ) ;
11051107 outf . Write ( PowerReduction ) ;
1108+ outf . Write ( Battery ) ;
1109+ outf . Write ( PowerKey ) ;
11061110 outf . Write ( ScoopIsBroken ) ;
11071111 outf . Write ( IsWaterScoopDown ) ;
11081112 outf . Write ( CurrentTrackSandBoxCapacityM3 ) ;
@@ -1145,6 +1149,8 @@ public override void Restore(BinaryReader inf)
11451149 ControllerFactory . Restore ( SteamHeatController , inf ) ;
11461150 AcceptMUSignals = inf . ReadBoolean ( ) ;
11471151 PowerReduction = inf . ReadSingle ( ) ;
1152+ Battery = inf . ReadBoolean ( ) ;
1153+ PowerKey = inf . ReadBoolean ( ) ;
11481154 ScoopIsBroken = inf . ReadBoolean ( ) ;
11491155 IsWaterScoopDown = inf . ReadBoolean ( ) ;
11501156 CurrentTrackSandBoxCapacityM3 = inf . ReadSingle ( ) ;
@@ -3886,6 +3892,20 @@ public void ToggleCabLight()
38863892 Simulator . Confirmer . Confirm ( CabControl . CabLight , CabLightOn ? CabSetting . On : CabSetting . Off ) ;
38873893 }
38883894
3895+ public void ToggleBattery ( )
3896+ {
3897+ Battery = ! Battery ;
3898+ if ( Battery ) SignalEvent ( Event . BatteryOn ) ;
3899+ else SignalEvent ( Event . BatteryOff ) ;
3900+ if ( Simulator . PlayerLocomotive == this ) Simulator . Confirmer . Confirm ( CabControl . Battery , Battery ? CabSetting . On : CabSetting . Off ) ;
3901+ }
3902+ public void TogglePowerKey ( )
3903+ {
3904+ PowerKey = ! PowerKey ;
3905+ if ( PowerKey ) SignalEvent ( Event . PowerKeyOn ) ;
3906+ else SignalEvent ( Event . PowerKeyOff ) ;
3907+ if ( Simulator . PlayerLocomotive == this ) Simulator . Confirmer . Confirm ( CabControl . PowerKey , PowerKey ? CabSetting . On : CabSetting . Off ) ;
3908+ }
38893909 public void ToggleCabRadio ( bool newState )
38903910 {
38913911 CabRadioOn = newState ;
@@ -4838,6 +4858,12 @@ public virtual float GetDataOf(CabViewControl cvc)
48384858 case CABViewControlTypes . ORTS_MIRRORS :
48394859 data = MirrorOpen ? 1 : 0 ;
48404860 break ;
4861+ case CABViewControlTypes . ORTS_BATTERY :
4862+ data = Battery ? 1 : 0 ;
4863+ break ;
4864+ case CABViewControlTypes . ORTS_POWERKEY :
4865+ data = PowerKey ? 1 : 0 ;
4866+ break ;
48414867 case CABViewControlTypes . ORTS_HOURDIAL :
48424868 float hour = ( float ) ( Simulator . ClockTime / 3600 ) % 12 ;
48434869 if ( hour < 0 )
0 commit comments