From afccd08fc767714804bdb71c6675501885a8524f Mon Sep 17 00:00:00 2001 From: KlyithSA <44346387+KlyithSA@users.noreply.github.com> Date: Tue, 26 Nov 2024 16:33:54 -0500 Subject: [PATCH] Fallback evaluators fixed Code was inaccurately copied from NathanKell's original aerogui, resulting in lift modules being skipped for lift/drag/terminalv calculation. --- RasterPropMonitor/Core/RPMVCEvaluators.cs | 64 +++++++++++------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/RasterPropMonitor/Core/RPMVCEvaluators.cs b/RasterPropMonitor/Core/RPMVCEvaluators.cs index aa61ddec..36f176b0 100644 --- a/RasterPropMonitor/Core/RPMVCEvaluators.cs +++ b/RasterPropMonitor/Core/RPMVCEvaluators.cs @@ -67,18 +67,18 @@ internal double FallbackEvaluateDragForce() Vector3 bodyLift = p.transform.rotation * (p.bodyLiftScalar * p.DragCubes.LiftForce); bodyLift = Vector3.ProjectOnPlane(bodyLift, -p.dragVectorDir); pureLiftV += bodyLift; + } - for (int m = 0; m < p.Modules.Count; m++) + for (int m = 0; m < p.Modules.Count; m++) + { + PartModule pm = p.Modules[m]; + if (pm.isEnabled && pm is ModuleLiftingSurface) { - PartModule pm = p.Modules[m]; - if (pm.isEnabled && pm is ModuleLiftingSurface) + ModuleLiftingSurface liftingSurface = pm as ModuleLiftingSurface; + if (!p.ShieldedFromAirstream) { - ModuleLiftingSurface liftingSurface = pm as ModuleLiftingSurface; - if (!p.ShieldedFromAirstream) - { - pureLiftV += liftingSurface.liftForce; - pureDragV += liftingSurface.dragForce; - } + pureLiftV += liftingSurface.liftForce; + pureDragV += liftingSurface.dragForce; } } } @@ -129,18 +129,18 @@ internal double FallbackEvaluateLiftForce() Vector3 bodyLift = p.transform.rotation * (p.bodyLiftScalar * p.DragCubes.LiftForce); bodyLift = Vector3.ProjectOnPlane(bodyLift, -p.dragVectorDir); pureLiftV += bodyLift; + } - for (int m = 0; m < p.Modules.Count; m++) + for (int m = 0; m < p.Modules.Count; m++) + { + PartModule pm = p.Modules[m]; + if (pm.isEnabled && pm is ModuleLiftingSurface) { - PartModule pm = p.Modules[m]; - if (pm.isEnabled && pm is ModuleLiftingSurface) + ModuleLiftingSurface liftingSurface = pm as ModuleLiftingSurface; + if (!p.ShieldedFromAirstream) { - ModuleLiftingSurface liftingSurface = pm as ModuleLiftingSurface; - if (!p.ShieldedFromAirstream) - { - pureLiftV += liftingSurface.liftForce; - pureDragV += liftingSurface.dragForce; - } + pureLiftV += liftingSurface.liftForce; + pureDragV += liftingSurface.dragForce; } } } @@ -175,23 +175,23 @@ internal double FallbackEvaluateTerminalVelocity() Vector3 bodyLift = p.transform.rotation * (p.bodyLiftScalar * p.DragCubes.LiftForce); bodyLift = Vector3.ProjectOnPlane(bodyLift, -p.dragVectorDir); pureLiftV += bodyLift; + } - for (int m = 0; m < p.Modules.Count; m++) + for (int m = 0; m < p.Modules.Count; m++) + { + PartModule pm = p.Modules[m]; + if (!pm.isEnabled) { - PartModule pm = p.Modules[m]; - if (!pm.isEnabled) - { - continue; - } + continue; + } - if (pm is ModuleLiftingSurface) - { - ModuleLiftingSurface liftingSurface = (ModuleLiftingSurface)pm; - if (p.ShieldedFromAirstream) - continue; - pureLiftV += liftingSurface.liftForce; - pureDragV += liftingSurface.dragForce; - } + if (pm is ModuleLiftingSurface) + { + ModuleLiftingSurface liftingSurface = (ModuleLiftingSurface)pm; + if (p.ShieldedFromAirstream) + continue; + pureLiftV += liftingSurface.liftForce; + pureDragV += liftingSurface.dragForce; } } }