Skip to content

Commit 8bc1d82

Browse files
authored
Merge pull request #985 from peternewell/chuff_bug
Correct bug with steam locomotive chuffing sound
2 parents 5d23965 + 6b79e53 commit 8bc1d82

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs

+10-4
Original file line numberDiff line numberDiff line change
@@ -3503,13 +3503,19 @@ private void UpdateFX(float elapsedClockSeconds)
35033503
// Variable is proportional to angular speed, value of 10 means 1 rotation/second.
35043504
// If wheel is not slipping then use normal wheel speed, this reduces oscillations in variable1 which causes issues with sounds.
35053505

3506-
if (SteamEngines[i].AttachedAxle.IsWheelSlip)
3506+
if (((Train.TrainType == Train.TRAINTYPE.PLAYER && !Train.Autopilot) || Train.TrainType == Train.TRAINTYPE.AI_PLAYERDRIVEN) && (Simulator.UseAdvancedAdhesion && !Simulator.Settings.SimpleControlPhysics))
35073507
{
3508-
variable[i] = Math.Abs(SteamEngines[i].AttachedAxle.SlipSpeedMpS / SteamEngines[i].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
3508+
variable[i] = Math.Abs((float)SteamEngines[i].AttachedAxle.AxleSpeedMpS / SteamEngines[i].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
35093509
}
3510-
else
3510+
else
3511+
// Axle code is not executed if it is an AI train, on Autopilot, or Simple adhesion or simple physics is selected. Hence must use wheelspeed in these instances
35113512
{
3512-
variable[i] = Math.Abs((float)SteamEngines[i].AttachedAxle.AxleSpeedMpS / SteamEngines[i].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
3513+
if (WheelSlip)
3514+
variable[i] = Math.Abs(WheelSpeedSlipMpS / SteamEngines[0].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
3515+
else
3516+
{
3517+
variable[i] = Math.Abs(WheelSpeedMpS / SteamEngines[0].AttachedAxle.WheelRadiusM / MathHelper.Pi * 5);
3518+
}
35133519
}
35143520

35153521
variable[i] = ThrottlePercent == 0 ? 0 : variable[i];

0 commit comments

Comments
 (0)