Skip to content

Commit

Permalink
Fix a FIVE AND A HALF YEAR OLD BUG where Proc Parts didn't detect MFT…
Browse files Browse the repository at this point in the history
… right.
  • Loading branch information
NathanKell committed Oct 10, 2023
1 parent 4ae92f5 commit 9f83e62
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Source/ProceduralPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -514,15 +514,16 @@ private void ChangeShape(ProceduralAbstractShape fromShape)
[KSPField]
public bool displayCost = true;

private bool? _hasMFT = null;

public ModifierChangeWhen GetModuleCostChangeWhen () => ModifierChangeWhen.FIXED;

private bool ContainsMFT(Part p)
{
foreach (PartModule pm in p.Modules)
{
if (pm.name.Equals("ModuleFuelTanks")) return true;
}
return false;
if (!_hasMFT.HasValue)
_hasMFT = part.Modules.Contains("ModuleFuelTanks");

return _hasMFT.Value;
}

private void GetResourceCosts(Part p, out float maxCost, out float actualCost)
Expand Down

0 comments on commit 9f83e62

Please sign in to comment.