From ba584418ec8ba5c3cb3009d36f6524ef14b5123b Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Sun, 22 Oct 2023 17:34:53 -0400 Subject: [PATCH] Revert to HP based AppliedTraction for SteamLocomotives Better wheel-slip guestimations --- .../cam72cam/immersiverailroading/entity/Locomotive.java | 9 ++++++--- .../immersiverailroading/entity/LocomotiveSteam.java | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/cam72cam/immersiverailroading/entity/Locomotive.java b/src/main/java/cam72cam/immersiverailroading/entity/Locomotive.java index a653ff9db..fdedf48e1 100644 --- a/src/main/java/cam72cam/immersiverailroading/entity/Locomotive.java +++ b/src/main/java/cam72cam/immersiverailroading/entity/Locomotive.java @@ -64,6 +64,8 @@ public abstract class Locomotive extends FreightTank { @TagField("cogging") private boolean cogging = false; + private boolean slipping = false; + /* * * Stock Definitions @@ -394,7 +396,7 @@ public void onTick() { private double getStaticTractiveEffort(Speed speed) { return (Config.ConfigBalance.FuelRequired ? this.getWeight() : this.getMaxWeight()) // KG * 9.8 // M/S/S - * STEEL.staticFriction(STEEL) + * (slipping ? STEEL.kineticFriction(STEEL) : STEEL.staticFriction(STEEL)) * slipCoefficient(speed) / getDefinition().factorOfAdhesion() * Config.ConfigBalance.tractionMultiplier; @@ -407,8 +409,9 @@ protected double simulateWheelSlip() { double adhesionFactor = Math.abs(getAppliedTractiveEffort(getCurrentSpeed())) / getStaticTractiveEffort(getCurrentSpeed()); - if (adhesionFactor > 1) { - return Math.copySign((adhesionFactor-1)/10, getReverser()); + slipping = adhesionFactor > 1; + if (slipping) { + return Math.copySign((adhesionFactor-1)/5, getReverser()); } return 0; } diff --git a/src/main/java/cam72cam/immersiverailroading/entity/LocomotiveSteam.java b/src/main/java/cam72cam/immersiverailroading/entity/LocomotiveSteam.java index 0e692669e..6a975fb27 100644 --- a/src/main/java/cam72cam/immersiverailroading/entity/LocomotiveSteam.java +++ b/src/main/java/cam72cam/immersiverailroading/entity/LocomotiveSteam.java @@ -95,7 +95,8 @@ public double getAppliedTractiveEffort(Speed speed) { return 0; } - double traction_N = this.getDefinition().getStartingTractionNewtons(gauge); + //double traction_N = this.getDefinition().getStartingTractionNewtons(gauge); + double traction_N = this.getDefinition().getHorsePower(gauge) * 375 / Math.max(Math.abs(speed.imperial()), 1.0); if (Config.isFuelRequired(gauge)) { traction_N = traction_N / this.getDefinition().getMaxPSI(gauge) * this.getBoilerPressure(); }