/// <summary>The method invoked when a location is added or removed.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { if (!this.EnableAutomation) { return; } this.Monitor.VerboseLog("Location list changed, reloading machines in affected locations."); try { // remove locations foreach (GameLocation location in e.Removed) { this.ActiveMachineGroups.Remove(location); this.DisabledMachineGroups.Remove(location); } // add locations this.ReloadQueue.AddMany(e.Added); } catch (Exception ex) { this.HandleError(ex, "updating locations"); } }
/// <summary>The method invoked after locations are added or removed from the game.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { if (Context.IsMultiplayer) { foreach (GameLocation location in e.Added) { this.MigrateLegacyData(location); } } }
/// <summary>The method called after a location is added or removed.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { if (!Context.IsMainPlayer) { return; } // set greenhouse mode if applicable if (this.ShouldApply()) { this.SetCropMode(e.Added, true, this.EnabledLocations); } }
/********* ** Public methods *********/ /// <summary>The event called after the location list changes.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { // rescue lost horses if (Context.IsMainPlayer) { foreach (GameLocation location in e.Removed) { foreach (Horse horse in this.GetHorsesIn(location).ToArray()) { this.WarpHome(horse); } } } }
private void updateCritterLocationsList(object sender, LocationListChangedEventArgs args) { if (args.Added.Count() > 0) { foreach (GameLocation location in args.Added.ToList()) { updateCritterLocations(location); } } if (args.Removed.Count() > 0) { AllCritterLocations.RemoveAll(l => args.Removed.Contains(l.Location)); } //Helper.Events.World.LocationListChanged -= updateCritterLocationsList; }
private void OnLocationChanged(object sender, LocationListChangedEventArgs e) { // ignore if player hasn't loaded a save yet if (!Context.IsWorldReady) { return; } //Checks each game location as it's added to the list foreach (GameLocation location in e.Added) { //Then checks each monter in the list and adds them to a read-only list; prevents crashes when removing characters foreach (Monster monster in location.characters.OfType <Monster>().ToArray()) { //executes the RemoveIfApplicable to the specified location and monster this.RemoveIfApplicable(location, monster); } } }
/// <summary>The event called after the location list changes.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { if (!this.IsEnabled) { return; } // rescue lost tractors if (Context.IsMainPlayer) { foreach (GameLocation location in e.Removed) { foreach (Horse tractor in this.GetTractorsIn(location).ToArray()) { this.DismissTractor(tractor); } } } }
/// <summary>The event called after the location list changes.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { if (!this.IsEnabled) { return; } // rescue lost tractors if (Context.IsMainPlayer) { foreach (GameLocation location in e.Removed) { foreach (Horse tractor in this.GetTractorsIn(location).ToArray()) { TractorManager.SetLocation(tractor, Game1.getFarm(), tractor.DefaultPosition); } } } }
/// <summary>The method invoked when a location is added or removed.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void World_LocationListChanged(object sender, LocationListChangedEventArgs e) { if (!this.EnableAutomation) { return; } this.VerboseLog("Location list changed, reloading all machines."); try { this.MachineGroups.Clear(); foreach (GameLocation location in CommonHelper.GetLocations()) { this.ReloadQueue.Add(location); } } catch (Exception ex) { this.HandleError(ex, "updating locations"); } }
/// <summary> /// Location list changed event handler. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> private void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { foreach (GameLocation gameLocation in e.Added) { Monitor.VerboseLog($"Loading {gameLocation.Name}"); if (!locationProcessors.TryGetValue(gameLocation, out IList <Processor> processors)) { locationProcessors[gameLocation] = processors = new List <Processor>(); } foreach (SObject @object in gameLocation.Objects.Values) { if (ShouldReplaceWithProcessor(@object, out Processor processor)) { processors.Add(processor); } } PlaceObjects(gameLocation, processors); } }
private void OnLoadLocation(object sender, LocationListChangedEventArgs e) { foreach (GameLocation gameLocation in e.Added) { if (!locationProcessors.ContainsKey(gameLocation)) { locationProcessors.Add(gameLocation, new List <Processor>()); } List <Processor> processors = new List <Processor>(); foreach (SObject @object in gameLocation.Objects.Values) { if (@object.bigCraftable.Value && Processor.WhichProcessor(@object.ParentSheetIndex) != null && !(@object is Processor)) { Processor processor = Processor.FromObject(@object); processors.Add(processor); } } PlaceObjects(gameLocation, processors); } }
/// <inheritdoc cref="IWorldEvents.LocationListChanged"/> /// <param name="sender">The event sender.</param> /// <param name="e">The event data.</param> private void OnLocationListChanged(object?sender, LocationListChangedEventArgs e) { if (!this.EnableAutomation) { return; } this.Monitor.VerboseLog("Location list changed, reloading machines in affected locations."); try { if (e.Removed.Any()) { this.MachineManager.QueueRemove(e.Removed); } this.MachineManager.QueueReload(e.Added); } catch (Exception ex) { this.HandleError(ex, "updating locations"); } }
private void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { Routing.Reset(); }
/// <summary>The method called after a location is added or removed.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { // handle locations added after day start this.ApplyChanges(e.Added); }
private void WorldOnLocationListChanged(object?sender, LocationListChangedEventArgs e) { // TODO: search for all networks }
/// <inheritdoc cref="IWorldEvents.LocationListChanged"/> /// <param name="sender">The event sender.</param> /// <param name="e">The event data.</param> private void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { this.LocationUtil.ScanLocationContexts(); }
private void World_LocationListChanged(object sender, LocationListChangedEventArgs e) { GetLocationContexts(); }
/// <summary>Raised after a game location is added or removed.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { this.Locations = CJB.GetAllLocations().ToArray(); }
/// <summary>Raised after a game location is added or removed.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { this.ResetLocationCache(); }
/// <summary>Raised after a game location is added or removed.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> protected virtual void OnLocationListChanged(object sender, LocationListChangedEventArgs e) { }