Skip to content

Commit

Permalink
Add forced ullaging right before ignition
Browse files Browse the repository at this point in the history
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
  • Loading branch information
lamont-granquist committed Nov 10, 2023
1 parent cd846e3 commit fa93eac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion MechJeb2/MechJebModuleNodeExecutor.cs
Expand Up @@ -13,7 +13,7 @@ public class MechJebModuleNodeExecutor : ComputerModule
[Persistent(pass = (int)Pass.GLOBAL)]
public bool Autowarp = true;

// how many seconds before a burn to end warp
// how many seconds before a burn to end warp (and start ullaging in RO)
[Persistent(pass = (int)Pass.GLOBAL)]
public readonly EditableDouble LeadTime = new EditableDouble(3);

Expand Down Expand Up @@ -141,6 +141,13 @@ private void DoRCS(FlightCtrlState s)
if (!Core.Thrust.AutoRCSUllaging)
return;

// always apply MIN_RCS_TIME of ullage right before the ignition time
// (in particular this avoids single-tick sequencing problems with MJ seeing 100% ullage
// but RF running later in the same tick and decrementing the ullage while allowing
// the engine to fire, and just generally assures that ullage is pretty stable before firing).
if (VesselState.time >= _ignitionUT - MIN_RCS_TIME)
_ullageUntil = _ignitionUT;

if (VesselState.lowestUllage >= 1.0 && VesselState.time > _ullageUntil)
return;

Expand Down

0 comments on commit fa93eac

Please sign in to comment.