Skip to content

Commit 563855f

Browse files
committed
Staging: Fix stock fairings ignoring autostage conditions
Stock fairings (ModuleProceduralFairing) were not correctly identified as fairings, causing them to be staged immediately when no active engines were found. This ensures they respect dynamic pressure and altitude settings.
1 parent b90a76d commit 563855f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

MechJeb2/MechJebModuleStagingController.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public override void OnUpdate()
305305
}
306306

307307
// always stage if we have no active engines
308-
if (!InverseStageHasActiveEngines(Vessel.currentStage))
308+
if (!InverseStageHasActiveEngines(Vessel.currentStage) && !WaitingForFairing())
309309
{
310310
Stage();
311311
}
@@ -321,7 +321,7 @@ public override void OnUpdate()
321321
return;
322322

323323
// Always drop deactivated engines or tanks
324-
if (InverseStageDecouplesDeactivatedEngineOrTank(Vessel.currentStage - 1))
324+
if (InverseStageDecouplesDeactivatedEngineOrTank(Vessel.currentStage - 1) && !WaitingForFairing())
325325
{
326326
Stage();
327327
}
@@ -671,6 +671,9 @@ private bool HasFairingUncached(int inverseStage)
671671
// decoupler check below
672672
return _partsInStage.Slinq().All(p => p.IsProceduralFairingPayloadFairing());
673673

674+
if (_partsInStage.Slinq().Any(p => p.Modules.Contains("ModuleProceduralFairing")))
675+
return true;
676+
674677
// this is simple, but subtle:
675678
// 1. we do not identify fairings as separate from decouplers here because of part mods like RSB
676679
// which only put a stock decoupler in the staging.

0 commit comments

Comments
 (0)