@@ -47,6 +47,7 @@ public float CenterOffsetComponent
4747 {
4848 get => VerticalTransfer ? CenterOffset . Y : CenterOffset . X ;
4949 }
50+ public float OffsetDiff = 1.4f ;
5051 // Dynamic data
5152 public bool Forward ; // forward motion on
5253 public bool Reverse ; // reverse motion on
@@ -172,15 +173,27 @@ protected void InitializeOffsetsAndTrackNodes()
172173 /// Returns the Y angle to be compared.
173174 /// </summary>
174175 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 )
175188 {
176189 if ( ! Continuous ) return ;
177190 Continuous = false ;
178191 GoToTarget = false ;
179192 Forward = isForward ;
180193 Reverse = ! isForward ;
194+ OffsetDiff = RemotelyControlled ? 2.8f : 1.4f ;
181195 if ( Forward )
182196 {
183- var offsetDiff = 1.4f ;
184197 Connected = false ;
185198 if ( Offsets . Count <= 0 )
186199 {
@@ -194,7 +207,7 @@ public override void ComputeTarget(bool isForward)
194207 if ( MyTrackNodesIndex [ iOffset ] != - 1 && MyTrVectorSectionsIndex [ iOffset ] != - 1 )
195208 {
196209 var thisOffsetDiff = Offsets [ iOffset ] - OffsetPos ;
197- if ( thisOffsetDiff < offsetDiff && thisOffsetDiff >= 0 )
210+ if ( thisOffsetDiff < OffsetDiff && thisOffsetDiff >= 0 )
198211 {
199212 ConnectedTarget = iOffset ;
200213 break ;
@@ -211,7 +224,6 @@ public override void ComputeTarget(bool isForward)
211224 }
212225 else if ( Reverse )
213226 {
214- var offsetDiff = - 1.4f ;
215227 Connected = false ;
216228 if ( Offsets . Count <= 0 )
217229 {
@@ -225,7 +237,7 @@ public override void ComputeTarget(bool isForward)
225237 if ( MyTrackNodesIndex [ iOffset ] != - 1 && MyTrVectorSectionsIndex [ iOffset ] != - 1 )
226238 {
227239 var thisOffsetDiff = Offsets [ iOffset ] - OffsetPos ;
228- if ( thisOffsetDiff > offsetDiff && thisOffsetDiff <= 0 )
240+ if ( thisOffsetDiff > - OffsetDiff && thisOffsetDiff <= 0 )
229241 {
230242 ConnectedTarget = iOffset ;
231243 break ;
@@ -241,6 +253,7 @@ public override void ComputeTarget(bool isForward)
241253 }
242254
243255 }
256+ RemotelyControlled = false ;
244257 return ;
245258 }
246259
@@ -250,6 +263,28 @@ public override void ComputeTarget(bool isForward)
250263 /// </summary>
251264 ///
252265 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 )
253288 {
254289 if ( TrainsOnMovingTable . Count > 1 || ( TrainsOnMovingTable . Count == 1 && TrainsOnMovingTable [ 0 ] . FrontOnBoard ^ TrainsOnMovingTable [ 0 ] . BackOnBoard ) )
255290 {
@@ -263,13 +298,6 @@ public override void StartContinuous(bool isForward)
263298 {
264299 // Preparing for transfer
265300 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- }
273301 if ( train . ControlMode == Train . TRAIN_CONTROL . MANUAL || train . ControlMode == Train . TRAIN_CONTROL . EXPLORER || train . ControlMode == Train . TRAIN_CONTROL . UNDEFINED )
274302 {
275303 SaveConnected = Connected ^ ! MyTrackNodesOrientation [ ConnectedTrackEnd ] ;
0 commit comments