@@ -47,6 +47,7 @@ public float CenterOffsetComponent
47
47
{
48
48
get => VerticalTransfer ? CenterOffset . Y : CenterOffset . X ;
49
49
}
50
+ public float OffsetDiff = 1.4f ;
50
51
// Dynamic data
51
52
public bool Forward ; // forward motion on
52
53
public bool Reverse ; // reverse motion on
@@ -172,15 +173,27 @@ protected void InitializeOffsetsAndTrackNodes()
172
173
/// Returns the Y angle to be compared.
173
174
/// </summary>
174
175
public override void ComputeTarget ( bool isForward )
176
+ {
177
+ if ( ! Continuous ) return ;
178
+ if ( MultiPlayer . MPManager . IsMultiPlayer ( ) )
179
+ {
180
+ SubMessageCode = submessagecode . GoToTarget ;
181
+ MultiPlayer . MPManager . Notify ( new MultiPlayer . MSGMovingTbl ( Simulator . ActiveMovingTableIndex , Orts . MultiPlayer . MPManager . GetUserName ( ) , SubMessageCode , isForward , OffsetPos ) . ToString ( ) ) ;
182
+ }
183
+ RemotelyControlled = false ;
184
+ GeneralComputeTarget ( isForward ) ;
185
+ }
186
+
187
+ public void GeneralComputeTarget ( bool isForward )
175
188
{
176
189
if ( ! Continuous ) return ;
177
190
Continuous = false ;
178
191
GoToTarget = false ;
179
192
Forward = isForward ;
180
193
Reverse = ! isForward ;
194
+ OffsetDiff = RemotelyControlled ? 2.8f : 1.4f ;
181
195
if ( Forward )
182
196
{
183
- var offsetDiff = 1.4f ;
184
197
Connected = false ;
185
198
if ( Offsets . Count <= 0 )
186
199
{
@@ -194,7 +207,7 @@ public override void ComputeTarget(bool isForward)
194
207
if ( MyTrackNodesIndex [ iOffset ] != - 1 && MyTrVectorSectionsIndex [ iOffset ] != - 1 )
195
208
{
196
209
var thisOffsetDiff = Offsets [ iOffset ] - OffsetPos ;
197
- if ( thisOffsetDiff < offsetDiff && thisOffsetDiff >= 0 )
210
+ if ( thisOffsetDiff < OffsetDiff && thisOffsetDiff >= 0 )
198
211
{
199
212
ConnectedTarget = iOffset ;
200
213
break ;
@@ -211,7 +224,6 @@ public override void ComputeTarget(bool isForward)
211
224
}
212
225
else if ( Reverse )
213
226
{
214
- var offsetDiff = - 1.4f ;
215
227
Connected = false ;
216
228
if ( Offsets . Count <= 0 )
217
229
{
@@ -225,7 +237,7 @@ public override void ComputeTarget(bool isForward)
225
237
if ( MyTrackNodesIndex [ iOffset ] != - 1 && MyTrVectorSectionsIndex [ iOffset ] != - 1 )
226
238
{
227
239
var thisOffsetDiff = Offsets [ iOffset ] - OffsetPos ;
228
- if ( thisOffsetDiff > offsetDiff && thisOffsetDiff <= 0 )
240
+ if ( thisOffsetDiff > - OffsetDiff && thisOffsetDiff <= 0 )
229
241
{
230
242
ConnectedTarget = iOffset ;
231
243
break ;
@@ -241,6 +253,7 @@ public override void ComputeTarget(bool isForward)
241
253
}
242
254
243
255
}
256
+ RemotelyControlled = false ;
244
257
return ;
245
258
}
246
259
@@ -250,6 +263,28 @@ public override void ComputeTarget(bool isForward)
250
263
/// </summary>
251
264
///
252
265
public override void StartContinuous ( bool isForward )
266
+ {
267
+ if ( TrainsOnMovingTable . Count == 1 && TrainsOnMovingTable [ 0 ] . FrontOnBoard && TrainsOnMovingTable [ 0 ] . BackOnBoard )
268
+ {
269
+ // Preparing for rotation
270
+ var train = TrainsOnMovingTable [ 0 ] . Train ;
271
+ if ( Math . Abs ( train . SpeedMpS ) > 0.1 || ( train . LeadLocomotiveIndex != - 1 && ( train . LeadLocomotive . ThrottlePercent >= 1 || train . TrainType != Train . TRAINTYPE . REMOTE && ! ( train . LeadLocomotive . Direction == Direction . N
272
+ || Math . Abs ( train . MUReverserPercent ) <= 1 ) ) ) || ( train . ControlMode != Train . TRAIN_CONTROL . MANUAL && train . ControlMode != Train . TRAIN_CONTROL . TURNTABLE &&
273
+ train . ControlMode != Train . TRAIN_CONTROL . EXPLORER && train . ControlMode != Train . TRAIN_CONTROL . UNDEFINED ) )
274
+ {
275
+ if ( SendNotifications ) Simulator . Confirmer . Warning ( Simulator . Catalog . GetStringFmt ( "Rotation can't start: check throttle, speed, direction and control mode" ) ) ;
276
+ return ;
277
+ }
278
+ }
279
+ if ( MultiPlayer . MPManager . IsMultiPlayer ( ) )
280
+ {
281
+ SubMessageCode = submessagecode . StartingContinuous ;
282
+ MultiPlayer . MPManager . Notify ( new MultiPlayer . MSGMovingTbl ( Simulator . ActiveMovingTableIndex , Orts . MultiPlayer . MPManager . GetUserName ( ) , SubMessageCode , isForward , OffsetPos ) . ToString ( ) ) ;
283
+ }
284
+ GeneralStartContinuous ( isForward ) ;
285
+ }
286
+
287
+ public void GeneralStartContinuous ( bool isForward )
253
288
{
254
289
if ( TrainsOnMovingTable . Count > 1 || ( TrainsOnMovingTable . Count == 1 && TrainsOnMovingTable [ 0 ] . FrontOnBoard ^ TrainsOnMovingTable [ 0 ] . BackOnBoard ) )
255
290
{
@@ -263,13 +298,6 @@ public override void StartContinuous(bool isForward)
263
298
{
264
299
// Preparing for transfer
265
300
var train = TrainsOnMovingTable [ 0 ] . Train ;
266
- if ( Math . Abs ( train . SpeedMpS ) > 0.1 || ( train . LeadLocomotiveIndex != - 1 && ( train . LeadLocomotive . ThrottlePercent >= 1 || ! ( train . LeadLocomotive . Direction == Direction . N
267
- || Math . Abs ( train . MUReverserPercent ) <= 1 ) ) ) || ( train . ControlMode != Train . TRAIN_CONTROL . MANUAL && train . ControlMode != Train . TRAIN_CONTROL . TURNTABLE &&
268
- train . ControlMode != Train . TRAIN_CONTROL . EXPLORER && train . ControlMode != Train . TRAIN_CONTROL . UNDEFINED ) )
269
- {
270
- Simulator . Confirmer . Warning ( Simulator . Catalog . GetStringFmt ( "Transfer can't start: check throttle, speed, direction and control mode" ) ) ;
271
- return ;
272
- }
273
301
if ( train . ControlMode == Train . TRAIN_CONTROL . MANUAL || train . ControlMode == Train . TRAIN_CONTROL . EXPLORER || train . ControlMode == Train . TRAIN_CONTROL . UNDEFINED )
274
302
{
275
303
SaveConnected = Connected ^ ! MyTrackNodesOrientation [ ConnectedTrackEnd ] ;
0 commit comments