File tree Expand file tree Collapse file tree 3 files changed +36
-4
lines changed
Simulation/RollingStocks/SubSystems/Controllers Expand file tree Collapse file tree 3 files changed +36
-4
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,21 @@ public float MainReservoirPressureBar()
141
141
/// </summary>
142
142
public float CurrentValue ( ) => Host . CurrentValue ;
143
143
144
+ /// <summary>
145
+ /// Intermediate value of the brake controller
146
+ /// </summary>
147
+ public float IntermediateValue
148
+ {
149
+ get
150
+ {
151
+ return Host . IntermediateValue ;
152
+ }
153
+ set
154
+ {
155
+ Host . IntermediateValue = value ;
156
+ }
157
+ }
158
+
144
159
/// <summary>
145
160
/// Minimum value of the brake controller
146
161
/// </summary>
@@ -171,6 +186,21 @@ public float MainReservoirPressureBar()
171
186
/// </summary>
172
187
public float CruiseControlBrakeDemand ( ) => Locomotive . CruiseControl != null ? Locomotive . CruiseControl . TrainBrakePercent / 100 : 0 ;
173
188
189
+ /// <summary>
190
+ /// Current notch of the brake controller
191
+ /// </summary>
192
+ public int CurrentNotch
193
+ {
194
+ get
195
+ {
196
+ return Host . CurrentNotch ;
197
+ }
198
+ set
199
+ {
200
+ Host . CurrentNotch = value ;
201
+ }
202
+ }
203
+
174
204
/// <summary>
175
205
/// Sets the current value of the brake controller lever
176
206
/// </summary>
Original file line number Diff line number Diff line change @@ -155,12 +155,12 @@ public bool OverchargeButtonPressed
155
155
/// <summary>
156
156
/// Needed for proper mouse operation in the cabview
157
157
/// </summary>
158
- public float IntermediateValue { get { return Script is MSTSBrakeController ? ( Script as MSTSBrakeController ) . NotchController . IntermediateValue : CurrentValue ; } }
158
+ public float IntermediateValue { get ; set ; }
159
159
160
160
/// <summary>
161
161
/// Knowing actual notch and its change is needed for proper repeatability of mouse and RailDriver operation
162
162
/// </summary>
163
- public int CurrentNotch { get { return Script is MSTSBrakeController ? ( Script as MSTSBrakeController ) . NotchController . CurrentNotch : 0 ; } set { } }
163
+ public int CurrentNotch { get ; set ; }
164
164
165
165
public ControllerState TrainBrakeControllerState
166
166
{
Original file line number Diff line number Diff line change 15
15
// You should have received a copy of the GNU General Public License
16
16
// along with Open Rails. If not, see <http://www.gnu.org/licenses/>.
17
17
18
- using ORTS . Scripting . Api ;
19
18
using System ;
20
- using System . Diagnostics ;
19
+ using ORTS . Scripting . Api ;
21
20
22
21
namespace Orts . Simulation . RollingStocks . SubSystems . Controllers
23
22
{
@@ -61,13 +60,16 @@ public override void InitializeMoving()
61
60
NotchController . SetValue ( 0 ) ;
62
61
if ( NotchController . NotchCount ( ) > 0 ) NotchController . CurrentNotch = 0 ;
63
62
else NotchController . CurrentNotch = - 1 ;
63
+ CurrentNotch = NotchController . CurrentNotch ;
64
64
}
65
65
66
66
public override float Update ( float elapsedSeconds )
67
67
{
68
68
float value = NotchController . Update ( elapsedSeconds ) ;
69
69
SetCurrentValue ( value ) ;
70
+ IntermediateValue = NotchController . IntermediateValue ;
70
71
SetUpdateValue ( NotchController . UpdateValue ) ;
72
+ CurrentNotch = NotchController . CurrentNotch ;
71
73
return value ;
72
74
}
73
75
You can’t perform that action at this time.
0 commit comments