Skip to content

Commit

Permalink
Warp past 10 minutes if we're already aligned
Browse files Browse the repository at this point in the history
If there's no need to drop out of warp, don't.

Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
  • Loading branch information
lamont-granquist committed Oct 29, 2023
1 parent 0d2025b commit 866e7be
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions MechJeb2/MechJebModuleNodeExecutor.cs
Expand Up @@ -193,6 +193,12 @@ private void StateWarpAlign()
return;
}

if (MuUtils.PhysicsRunning() ? AlignedAndSettled() : AngleFromDirection() < Deg2Rad(10))
{
Core.Warp.WarpToUT(_ignitionUT - LeadTime);
return;
}

double timeToBurn = _ignitionUT - VesselState.time;

if (timeToBurn > 600)
Expand All @@ -201,12 +207,8 @@ private void StateWarpAlign()
return;
}

Core.Warp.MinimumWarp();
SetAttitude();

if (MuUtils.PhysicsRunning() ? AlignedAndSettled() : AngleFromDirection() < Deg2Rad(10))
Core.Warp.WarpToUT(_ignitionUT - LeadTime);
else
Core.Warp.MinimumWarp();
}

private void StateLeadTime()
Expand Down

0 comments on commit 866e7be

Please sign in to comment.