private void GetDockingBays() { RemoveDockingBayListeners(); dockingBays = subRoot.GetComponentsInChildren <VehicleDockingBay>().ToList(); AddDockingBayListeners(); UpdateDockedVehicles(); #if USE_AUTOSORT autosorters = subRoot.GetComponentsInChildren <AutosortLocker>().ToList(); #endif }
private void GetDockingBays() { RemoveDockingBayListeners(); dockingBays = subRoot.GetComponentsInChildren<VehicleDockingBay>(); AddDockingBayListeners(); UpdateDockedVehicles(); if (Mod.config.UseAutosortMod) { autosorters = subRoot.GetComponentsInChildren(AutosortLockerType).ToList(); } }
/// <summary> /// Synchronizes the buildables, executing the <see cref="ConnectWithManager"/> method on each one found. /// </summary> public virtual void SyncBuildables() { tempBuildables.Clear(); if (Cyclops == null) { return; } BuildableMono[] buildables = Cyclops.GetComponentsInChildren <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); } }
static void SubRoot_Start_Postfix(SubRoot __instance) { if (!__instance.isBase) // we're in cyclops { __instance.GetComponentsInChildren <Openable>().ForEach(door => door.Invoke("Close", 0.5f)); } }
public static bool TryOverflowIntoCyclopsBioreactors(SubRoot subRoot, TechType fishType, ref int breedCount) { CyBioReactorMono[] cyBioReactors = subRoot.GetComponentsInChildren <CyBioReactorMono>() ?? new CyBioReactorMono[0]; if (cyBioReactors.Length == 0) { return(breedCount > 0); } Vector2int sizePerFish = CraftData.GetItemSize(fishType); int failCount = 0; while (failCount < cyBioReactors.Length && breedCount > 0) { foreach (CyBioReactorMono reactor in cyBioReactors) { if (breedCount > 0 && reactor.container.HasRoomFor(sizePerFish.x, sizePerFish.y)) { CoroutineHost.StartCoroutine(AddToReactor(subRoot, fishType, sizePerFish, reactor)); breedCount--; } else { failCount++; } } if (failCount < cyBioReactors.Length) { failCount = 0; } } return(breedCount > 0); }
private void AccumulateTargets() { singleItemTargets.Clear(); categoryTargets.Clear(); anyTargets.Clear(); SubRoot subRoot = gameObject.GetComponentInParent <SubRoot>(); if (subRoot == null) { return; } var allTargets = subRoot.GetComponentsInChildren <AutosortTarget>().ToList(); foreach (var target in allTargets) { if (target.isActiveAndEnabled && target.CanAddItems()) { if (target.CanTakeAnyItem()) { anyTargets.Add(target); } else { if (target.HasItemFilters()) { singleItemTargets.Add(target); } if (target.HasCategoryFilters()) { categoryTargets.Add(target); } } } } }