@@ -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
@@ -1100,6 +1102,8 @@ public override void Save(BinaryWriter outf)
11001102 ControllerFactory . Save ( SteamHeatController , outf ) ;
11011103 outf . Write ( AcceptMUSignals ) ;
11021104 outf . Write ( PowerReduction ) ;
1105+ outf . Write ( Battery ) ;
1106+ outf . Write ( PowerKey ) ;
11031107 outf . Write ( ScoopIsBroken ) ;
11041108 outf . Write ( IsWaterScoopDown ) ;
11051109 outf . Write ( CurrentTrackSandBoxCapacityM3 ) ;
@@ -1142,6 +1146,8 @@ public override void Restore(BinaryReader inf)
11421146 ControllerFactory . Restore ( SteamHeatController , inf ) ;
11431147 AcceptMUSignals = inf . ReadBoolean ( ) ;
11441148 PowerReduction = inf . ReadSingle ( ) ;
1149+ Battery = inf . ReadBoolean ( ) ;
1150+ PowerKey = inf . ReadBoolean ( ) ;
11451151 ScoopIsBroken = inf . ReadBoolean ( ) ;
11461152 IsWaterScoopDown = inf . ReadBoolean ( ) ;
11471153 CurrentTrackSandBoxCapacityM3 = inf . ReadSingle ( ) ;
@@ -3883,6 +3889,20 @@ public void ToggleCabLight()
38833889 Simulator . Confirmer . Confirm ( CabControl . CabLight , CabLightOn ? CabSetting . On : CabSetting . Off ) ;
38843890 }
38853891
3892+ public void ToggleBattery ( )
3893+ {
3894+ Battery = ! Battery ;
3895+ if ( Battery ) SignalEvent ( Event . BatteryOn ) ;
3896+ else SignalEvent ( Event . BatteryOff ) ;
3897+ if ( Simulator . PlayerLocomotive == this ) Simulator . Confirmer . Confirm ( CabControl . Battery , Battery ? CabSetting . On : CabSetting . Off ) ;
3898+ }
3899+ public void TogglePowerKey ( )
3900+ {
3901+ PowerKey = ! PowerKey ;
3902+ if ( PowerKey ) SignalEvent ( Event . PowerKeyOn ) ;
3903+ else SignalEvent ( Event . PowerKeyOff ) ;
3904+ if ( Simulator . PlayerLocomotive == this ) Simulator . Confirmer . Confirm ( CabControl . PowerKey , PowerKey ? CabSetting . On : CabSetting . Off ) ;
3905+ }
38863906 public void ToggleCabRadio ( bool newState )
38873907 {
38883908 CabRadioOn = newState ;
@@ -4835,6 +4855,12 @@ public virtual float GetDataOf(CabViewControl cvc)
48354855 case CABViewControlTypes . ORTS_MIRRORS :
48364856 data = MirrorOpen ? 1 : 0 ;
48374857 break ;
4858+ case CABViewControlTypes . ORTS_BATTERY :
4859+ data = Battery ? 1 : 0 ;
4860+ break ;
4861+ case CABViewControlTypes . ORTS_POWERKEY :
4862+ data = PowerKey ? 1 : 0 ;
4863+ break ;
48384864 case CABViewControlTypes . ORTS_HOURDIAL :
48394865 float hour = ( float ) ( Simulator . ClockTime / 3600 ) % 12 ;
48404866 if ( hour < 0 )
0 commit comments