Skip to content

Commit

Permalink
Change some RCS "display" logic
Browse files Browse the repository at this point in the history
If you have a stage which has RCS and a thruster that both pull the
same fuel (e.g. MMH+NTO) then the "RCS ∆v max value" which is really
the value-after-all-the-normal-engine-fuel-tanks-are-drained will be
zero because the thruster drained all the shared RCS fuel.

So use the "min" values for stuff like resources burned and deltatime
and the showEmpty button should key off the min value instead of max.

Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
  • Loading branch information
lamont-granquist committed Aug 4, 2023
1 parent dbe7998 commit 8621b2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions MechJeb2/MechJebLib/Simulations/FuelFlowSimulation.cs
Expand Up @@ -394,14 +394,13 @@ private void FinishRcsSegment(bool max, double deltaTime, double startMass, doub
_currentSegment.MaxRcsDeltaV += rcsDeltaV;
if (_currentSegment.RcsStartTMR == 0)
_currentSegment.RcsStartTMR = rcsThrust / startMass;

_currentSegment.RcsMass += startMass - endMass;
_currentSegment.RcsDeltaTime += deltaTime;
}
else
{
_currentSegment.MinRcsDeltaV += rcsDeltaV;
_currentSegment.RcsEndTMR = _currentSegment.RcsThrust / endMass;
_currentSegment.RcsMass += startMass - endMass;
_currentSegment.RcsDeltaTime += deltaTime;
}
}

Expand Down
2 changes: 1 addition & 1 deletion MechJeb2/MechJebStageStatsHelper.cs
Expand Up @@ -138,7 +138,7 @@ private void GatherStages(List<int> stages)
for (int i = 0; i < stats.AtmoStats.Count; i++)
if (infoItems.showEmpty)
stages.Add(i);
else if (infoItems.showRcs && stats.AtmoStats[i].MaxRcsDeltaV > 0)
else if (infoItems.showRcs && stats.AtmoStats[i].MinRcsDeltaV > 0)
stages.Add(i);
else if (!infoItems.showRcs && stats.AtmoStats[i].DeltaV > 0)
stages.Add(i);
Expand Down

0 comments on commit 8621b2e

Please sign in to comment.