public virtual void SyncBuildables() { tempBuildables.Clear(); BuildableMono[] buildables = Cyclops.GetAllComponentsInChildren <BuildableMono>(); for (int b = 0; b < buildables.Length; b++) { BuildableMono buildable = buildables[b]; if (tempBuildables.Contains(buildable)) { continue; // Instances already found } tempBuildables.Add(buildable); if (!buildable.IsConnectedToCyclops) { ConnectWithManager(buildable); } } if (tempBuildables.Count != TrackedBuildables.Count) { TrackedBuildables.Clear(); TrackedBuildables.AddRange(tempBuildables); } }
internal void SyncBioReactors() { if (Manager == null) { return; } TempCache.Clear(); SubRoot cyclops = Cyclops; CyBioReactorMono[] cyBioReactors = cyclops.GetAllComponentsInChildren <CyBioReactorMono>(); foreach (CyBioReactorMono cyBioReactor in cyBioReactors) { if (TempCache.Contains(cyBioReactor)) { continue; // This is a workaround because of the object references being returned twice in this array. } TempCache.Add(cyBioReactor); if (cyBioReactor.ParentCyclops == null) { QuickLogger.Debug("CyBioReactorMono synced externally"); // This is a workaround to get a reference to the Cyclops into the AuxUpgradeConsole cyBioReactor.ConnectToCyclops(cyclops, Manager); } } if (TempCache.Count != CyBioReactors.Count) { CyBioReactors.Clear(); CyBioReactors.AddRange(TempCache); } }
internal void SyncUpgradeConsoles() { TempCache.Clear(); CyUpgradeConsoleMono[] auxUpgradeConsoles = Cyclops.GetAllComponentsInChildren <CyUpgradeConsoleMono>(); foreach (CyUpgradeConsoleMono auxConsole in auxUpgradeConsoles) { if (TempCache.Contains(auxConsole)) { continue; // This is a workaround because of the object references being returned twice in this array. } TempCache.Add(auxConsole); if (auxConsole.ParentCyclops == null) { QuickLogger.Debug("CyUpgradeConsoleMono synced externally"); // This is a workaround to get a reference to the Cyclops into the AuxUpgradeConsole auxConsole.ConnectToCyclops(Cyclops, this.Manager); } } if (TempCache.Count != this.AuxUpgradeConsoles.Count) { this.AuxUpgradeConsoles.Clear(); this.AuxUpgradeConsoles.AddRange(TempCache); } HandleUpgrades(); }
private static void HandleToggleableUpgrades(SubRoot __instance, Equipment modules, ref bool fireSupressionSystem) { var subControl = __instance.GetAllComponentsInChildren <SubControl>(); List <TechType> upgradeList = new List <TechType>(SlotHelper.SlotNames.Length); foreach (string slot in SlotHelper.SlotNames) { TechType techTypeInSlot = modules.GetTechTypeInSlot(slot); switch (techTypeInSlot) { case TechType.CyclopsShieldModule: __instance.shieldUpgrade = true; break; case TechType.CyclopsSonarModule: __instance.sonarUpgrade = true; break; case TechType.CyclopsSeamothRepairModule: __instance.vehicleRepairUpgrade = true; break; case TechType.CyclopsDecoyModule: __instance.decoyTubeSizeIncreaseUpgrade = true; break; case TechType.CyclopsFireSuppressionModule: fireSupressionSystem = true; break; // CyclopsThermalReactorModule handled in PowerManager.RechargeCyclops // CyclopsSpeedModule handled in PowerManager.UpdatePowerSpeedRating } upgradeList.Add(techTypeInSlot); } if (__instance.slotModSFX != null) { __instance.slotModSFX.Play(); } __instance.BroadcastMessage("RefreshUpgradeConsoleIcons", upgradeList.ToArray(), SendMessageOptions.RequireReceiver); }
public void SyncReactorsExternally() { var _tempCache = new List <CyNukeReactorMono>(); CyNukeReactorMono[] foundReactors = Cyclops.GetAllComponentsInChildren <CyNukeReactorMono>(); for (int r = 0; r < foundReactors.Length; r++) { CyNukeReactorMono reactor = foundReactors[r]; if (_tempCache.Contains(reactor)) { continue; // This is a workaround because of the object references being returned twice in this array. } _tempCache.Add(reactor); if (reactor.ParentCyclops == null) { QuickLogger.Debug("Cyclops Nuclear Reactor synced externally"); // This is a workaround to get a reference to the Cyclops into the CyNukeReactorMono reactor.ConnectToCyclops(Cyclops, this); } } }