@@ -187,6 +187,8 @@ public static Interpolator SteamHeatBoilerFuelUsageGalukpH()
187
187
public float CarWidthM = 2.5f ;
188
188
public float CarLengthM = 40 ; // derived classes must overwrite these defaults
189
189
public float CarHeightM = 4 ; // derived classes must overwrite these defaults
190
+ public int FrontArticulation = - 1 ; // -1: Determine front articulation automatically, 0: Force no front articulation, 1: Force front articulation
191
+ public int RearArticulation = - 1 ; // -1: Determine rear articulation automatically, 0: Force no rear articulation, 1: Force rear articulation
190
192
public float MassKG = 10000 ; // Mass in KG at runtime; coincides with InitialMassKG if there is no load and no ORTS freight anim
191
193
public float InitialMassKG = 10000 ;
192
194
public bool IsDriveable ;
@@ -2731,34 +2733,36 @@ public void SetUpWheels()
2731
2733
// Decided to control what is sent to SetUpWheelsArticulation()by using
2732
2734
// WheelAxlesLoaded as a flag. This way, wagons that have to be processed are included
2733
2735
// and the rest left out.
2734
- bool articulatedFront = ! WheelAxles . Any ( a => a . OffsetM . Z < 0 ) ;
2735
- bool articulatedRear = ! WheelAxles . Any ( a => a . OffsetM . Z > 0 ) ;
2736
- var carIndex = Train . Cars . IndexOf ( this ) ;
2737
- //Certain locomotives are testing as articulated wagons for some reason.
2738
- if ( WagonType != WagonTypes . Engine )
2739
- if ( WheelAxles . Count != 1 && ( articulatedFront || articulatedRear ) )
2740
- {
2741
- WheelAxlesLoaded = true ;
2742
- SetUpWheelsArticulation ( carIndex ) ;
2743
- }
2736
+
2737
+ // Force articulation if stock is configured as such
2738
+ // Otherwise, use default behavior which gives articulation if there are no axles forward/reareward on the mode,
2739
+ // disables articulation on engines, and only allows articulation with 3 or fewer axles, but not 1 axle
2740
+ bool articulatedFront = ( FrontArticulation == 1 ||
2741
+ ( FrontArticulation == - 1 && ! WheelAxles . Any ( a => a . OffsetM . Z < 0 ) && WagonType != WagonTypes . Engine && WheelAxles . Count != 1 && WheelAxles . Count <= 3 ) ) ;
2742
+ bool articulatedRear = ( RearArticulation == 1 ||
2743
+ ( RearArticulation == - 1 && ! WheelAxles . Any ( a => a . OffsetM . Z > 0 ) && WagonType != WagonTypes . Engine && WheelAxles . Count != 1 && WheelAxles . Count <= 3 ) ) ;
2744
+
2745
+ if ( articulatedFront || articulatedRear )
2746
+ {
2747
+ WheelAxlesLoaded = true ;
2748
+ SetUpWheelsArticulation ( articulatedFront , articulatedRear ) ;
2749
+ }
2744
2750
} // end SetUpWheels()
2745
2751
2746
- protected void SetUpWheelsArticulation ( int carIndex )
2752
+ protected void SetUpWheelsArticulation ( bool front , bool rear )
2747
2753
{
2748
2754
// If there are no forward wheels, this car is articulated (joined
2749
2755
// to the car in front) at the front. Likewise for the rear.
2750
- bool articulatedFront = ! WheelAxles . Any ( a => a . OffsetM . Z < 0 ) ;
2751
- bool articulatedRear = ! WheelAxles . Any ( a => a . OffsetM . Z > 0 ) ;
2752
2756
// Original process originally used caused too many issues.
2753
2757
// The original process did include the below process of just using WheelAxles.Add
2754
2758
// if the initial test did not work. Since the below process is working without issues the
2755
2759
// original process was stripped down to what is below
2756
- if ( articulatedFront || articulatedRear )
2760
+ if ( front || rear )
2757
2761
{
2758
- if ( articulatedFront && WheelAxles . Count <= 3 )
2762
+ if ( front )
2759
2763
WheelAxles . Add ( new WheelAxle ( new Vector3 ( 0.0f , BogiePivotHeightM , - CarLengthM / 2.0f ) , 0 , 0 ) { Part = Parts [ 0 ] } ) ;
2760
2764
2761
- if ( articulatedRear && WheelAxles . Count <= 3 )
2765
+ if ( rear )
2762
2766
WheelAxles . Add ( new WheelAxle ( new Vector3 ( 0.0f , BogiePivotHeightM , CarLengthM / 2.0f ) , 0 , 0 ) { Part = Parts [ 0 ] } ) ;
2763
2767
2764
2768
WheelAxles . Sort ( WheelAxles [ 0 ] ) ;
0 commit comments