diff --git a/src/RealAntennasProject/ModuleRealAntenna.cs b/src/RealAntennasProject/ModuleRealAntenna.cs index 6bf760d..d0fc912 100644 --- a/src/RealAntennasProject/ModuleRealAntenna.cs +++ b/src/RealAntennasProject/ModuleRealAntenna.cs @@ -487,14 +487,24 @@ public virtual bool ResolveValidationError() private static 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); GameEvents.OnPartUpgradePurchased.Fire(upgd); return true; } + /// + /// 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(); + } + private static PartUpgradeHandler.Upgrade GetUpgradeForTL(int techLevel) { TechLevelInfo tlInf = TechLevelInfo.GetTechLevel(techLevel);