public void FacilityUpgradedEvent(Upgradeables.UpgradeableFacility facility, int lvl) { if (KCT_GUI.IsPrimarilyDisabled) { return; } KCTDebug.Log($"Facility {facility.id} upgraded to lvl {lvl}"); AllowedToUpgrade = false; foreach (KSCItem ksc in KCTGameStates.KSCs) { ksc.RecalculateBuildRates(); ksc.RecalculateUpgradedBuildRates(); } for (int i = KCTGameStates.TechList.Count - 1; i >= 0; i--) { TechItem tech = KCTGameStates.TechList[i]; tech.UpdateBuildRate(KCTGameStates.TechList.IndexOf(tech)); } }
public void FacilityUpgradedEvent(Upgradeables.UpgradeableFacility facility, int lvl) { if (KCT_GUI.IsPrimarilyDisabled) { bool isLaunchpad = facility.id.ToLower().Contains("launchpad"); if (!isLaunchpad) { return; } KCTGameStates.ActiveKSC.ActiveLPInstance.Upgrade(lvl); } KCTDebug.Log($"Facility {facility.id} upgraded to lvl {lvl}"); if (facility.id.ToLower().Contains("launchpad")) { if (!AllowedToUpgrade) { KCTGameStates.ActiveKSC.ActiveLPInstance.Upgrade(lvl); //also repairs the launchpad } else { KCTGameStates.ActiveKSC.ActiveLPInstance.level = lvl; } } AllowedToUpgrade = false; foreach (KSCItem ksc in KCTGameStates.KSCs) { ksc.RecalculateBuildRates(); ksc.RecalculateUpgradedBuildRates(); } for (int i = KCTGameStates.TechList.Count - 1; i >= 0; i--) { TechItem tech = KCTGameStates.TechList[i]; tech.UpdateBuildRate(KCTGameStates.TechList.IndexOf(tech)); } }