diff --git a/Source/ModuleROHeatshield.cs b/Source/ModuleROHeatshield.cs index dd2482a..bb4648e 100644 --- a/Source/ModuleROHeatshield.cs +++ b/Source/ModuleROHeatshield.cs @@ -353,8 +353,7 @@ public bool IsConfigUnlocked(string configName) public bool PurchaseConfig(PartUpgradeHandler.Upgrade upgd) { - CurrencyModifierQuery cmq = CurrencyModifierQuery.RunQuery(TransactionReasons.RnDPartPurchase, -upgd.entryCost, 0, 0); - if (!cmq.CanAfford()) + if (!CanAffordEntryCost(upgd.entryCost)) return false; PartUpgradeManager.Handler.SetUnlocked(upgd.name, true); @@ -464,7 +463,7 @@ private PartResource EnsureAblatorResource(string name) } /// - /// Called from RP0KCT + /// Called from RP-1 /// /// /// @@ -497,7 +496,7 @@ public virtual bool Validate(out string validationError, out bool canBeResolved, } /// - /// Called from RP0KCT + /// Called from RP-1 /// /// public virtual bool ResolveValidationError() @@ -508,6 +507,17 @@ public virtual bool ResolveValidationError() return PurchaseConfig(upgd); } + /// + /// NOTE: Harmony-patched from RP-1 to factor in unlock credit. + /// + /// + /// + private static bool CanAffordEntryCost(float cost) + { + CurrencyModifierQuery cmq = CurrencyModifierQuery.RunQuery(TransactionReasons.RnDPartPurchase, -cost, 0, 0); + return cmq.CanAfford(); + } + #endregion Custom Methods } }