diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-05-04 20:44:20 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-05-04 20:44:20 -0400 |
commit | 8051862c7bd2fe498657eef4bb102b5ca33390a6 (patch) | |
tree | c877a63aef6fd987adb1a4da727ae233d1978121 /src/SMAPI/Events/EventArgsLocationObjectsChanged.cs | |
parent | 05f81cb85f09c8e82ea125f520e4a264abfc3869 (diff) | |
download | SMAPI-8051862c7bd2fe498657eef4bb102b5ca33390a6.tar.gz SMAPI-8051862c7bd2fe498657eef4bb102b5ca33390a6.tar.bz2 SMAPI-8051862c7bd2fe498657eef4bb102b5ca33390a6.zip |
add LocationEvents.ObjectsChanged event
Diffstat (limited to 'src/SMAPI/Events/EventArgsLocationObjectsChanged.cs')
-rw-r--r-- | src/SMAPI/Events/EventArgsLocationObjectsChanged.cs | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/SMAPI/Events/EventArgsLocationObjectsChanged.cs b/src/SMAPI/Events/EventArgsLocationObjectsChanged.cs index de6bd365..a6138ddb 100644 --- a/src/SMAPI/Events/EventArgsLocationObjectsChanged.cs +++ b/src/SMAPI/Events/EventArgsLocationObjectsChanged.cs @@ -1,28 +1,46 @@ using System; using System.Collections.Generic; +using System.Linq; using Microsoft.Xna.Framework; using Netcode; -using Object = StardewValley.Object; +using StardewValley; +using SObject = StardewValley.Object; namespace StardewModdingAPI.Events { - /// <summary>Event arguments for a <see cref="LocationEvents.LocationObjectsChanged"/> event.</summary> + /// <summary>Event arguments for a <see cref="LocationEvents.LocationObjectsChanged"/> or <see cref="LocationEvents.ObjectsChanged"/> event.</summary> public class EventArgsLocationObjectsChanged : EventArgs { /********* ** Accessors *********/ + /// <summary>The location which changed.</summary> + public GameLocation Location { get; } + + /// <summary>The objects added to the list.</summary> + public IEnumerable<KeyValuePair<Vector2, SObject>> Added { get; } + + /// <summary>The objects removed from the list.</summary> + public IEnumerable<KeyValuePair<Vector2, SObject>> Removed { get; } + /// <summary>The current list of objects in the current location.</summary> - public IDictionary<Vector2, NetRef<Object>> NewObjects { get; } + [Obsolete("Use " + nameof(EventArgsLocationObjectsChanged.Added))] + public IDictionary<Vector2, NetRef<SObject>> NewObjects { get; } /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> + /// <param name="location">The location which changed.</param> + /// <param name="added">The objects added to the list.</param> + /// <param name="removed">The objects removed from the list.</param> /// <param name="newObjects">The current list of objects in the current location.</param> - public EventArgsLocationObjectsChanged(IDictionary<Vector2, NetRef<Object>> newObjects) + public EventArgsLocationObjectsChanged(GameLocation location, IEnumerable<KeyValuePair<Vector2, SObject>> added, IEnumerable<KeyValuePair<Vector2, SObject>> removed, IDictionary<Vector2, NetRef<SObject>> newObjects) { + this.Location = location; + this.Added = added.ToArray(); + this.Removed = removed.ToArray(); this.NewObjects = newObjects; } } |