From fa93eac31c23fbdf8b198d68d8c70d9b66188d1c Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Fri, 10 Nov 2023 12:01:40 -0800 Subject: [PATCH] Add forced ullaging right before ignition Signed-off-by: Lamont Granquist --- MechJeb2/MechJebModuleNodeExecutor.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MechJeb2/MechJebModuleNodeExecutor.cs b/MechJeb2/MechJebModuleNodeExecutor.cs index d0add72f..6805487a 100644 --- a/MechJeb2/MechJebModuleNodeExecutor.cs +++ b/MechJeb2/MechJebModuleNodeExecutor.cs @@ -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); @@ -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;