private IEnumerator CheckForMissingHoppers() { while (!_wolfRegistry.IsLoaded) { yield return(null); } var hoppers = _wolfRegistry.GetHoppers(); if (hoppers.Count > 0) { var hopperIds = GetHopperIds(); foreach (var hopper in hoppers) { if (!hopperIds.Contains(hopper.Id)) { Debug.LogWarning("[WOLF] ScenarioMonitor: Hopper with ID " + hopper.Id + " was not found in game."); var resourcesToRelease = new Dictionary <string, int>(); foreach (var input in hopper.Recipe.InputIngredients) { resourcesToRelease.Add(input.Key, input.Value * -1); } var result = hopper.Depot.NegotiateConsumer(resourcesToRelease); if (result is FailedNegotiationResult) { Debug.LogError("[WOLF] Could not release hopper resources back to depot."); } _wolfRegistry.RemoveHopper(hopper.Id); } } } }
protected void ReleaseResources() { var depot = _registry.GetDepot(DepotBody, DepotBiome); if (depot != null && IsConnectedToDepot) { var resourcesToRelease = new Dictionary<string, int>(); foreach (var input in WolfRecipe.InputIngredients) { resourcesToRelease.Add(input.Key, input.Value * -1); } var result = depot.NegotiateConsumer(resourcesToRelease); if (result is FailedNegotiationResult) { Debug.LogError("[WOLF] Could not release hopper resources back to depot."); } IsConnectedToDepot = false; } _registry.RemoveHopper(HopperId); }