Skip to content

Commit 72812da

Browse files
author
Chris Woerz
committed
Revert change based on code review
1 parent dcabad5 commit 72812da

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/RemoteTech2/FlightComputer/FlightCore.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,17 @@ public static void HoldOrientation(FlightCtrlState fs, FlightComputer f, Quatern
111111

112112
public static double GetTotalThrust(Vessel v)
113113
{
114-
var thrust = v.parts.SelectMany(p => p.FindModulesImplementing<ModuleEngines>())
115-
.Where(pm => pm.EngineIgnited)
116-
.Sum(pm => (double)pm.maxThrust * (pm.thrustPercentage / 100));
117-
thrust += v.parts.SelectMany(p => p.FindModulesImplementing<ModuleEnginesFX>())
118-
.Where(pm => pm.EngineIgnited)
119-
.Sum(pm => (double)pm.maxThrust * (pm.thrustPercentage / 100));
114+
double thrust = 0.0;
115+
foreach (var pm in v.parts.SelectMany(p => p.FindModulesImplementing<ModuleEngines>()))
116+
{
117+
if (!pm.EngineIgnited) continue;
118+
thrust += (double)pm.maxThrust * (pm.thrustPercentage / 100);
119+
}
120+
foreach (var pm in v.parts.SelectMany(p => p.FindModulesImplementing<ModuleEnginesFX>()))
121+
{
122+
if (!pm.EngineIgnited) continue;
123+
thrust += (double)pm.maxThrust * (pm.thrustPercentage / 100);
124+
}
120125
return thrust;
121126
}
122127
}

0 commit comments

Comments
 (0)