diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-01 02:14:01 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-01 02:14:01 -0400 |
commit | 07bbfea7dd9dac5bbacf8bfc3c35d3f65ec71b75 (patch) | |
tree | 073ce173468e3e26b6a9e7a61696ad2baeb7c59b /src/SMAPI/Events | |
parent | b3f116a8f123387b1f2f9ce1a099d1fd8081708d (diff) | |
download | SMAPI-07bbfea7dd9dac5bbacf8bfc3c35d3f65ec71b75.tar.gz SMAPI-07bbfea7dd9dac5bbacf8bfc3c35d3f65ec71b75.tar.bz2 SMAPI-07bbfea7dd9dac5bbacf8bfc3c35d3f65ec71b75.zip |
add NPC list changed event (#310)
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r-- | src/SMAPI/Events/IWorldEvents.cs | 3 | ||||
-rw-r--r-- | src/SMAPI/Events/WorldNpcListChangedEventArgs.cs | 38 |
2 files changed, 41 insertions, 0 deletions
diff --git a/src/SMAPI/Events/IWorldEvents.cs b/src/SMAPI/Events/IWorldEvents.cs index 7ec26bae..ce288ae1 100644 --- a/src/SMAPI/Events/IWorldEvents.cs +++ b/src/SMAPI/Events/IWorldEvents.cs @@ -14,6 +14,9 @@ namespace StardewModdingAPI.Events /// <summary>Raised after buildings are added or removed in a location.</summary> event EventHandler<WorldBuildingListChangedEventArgs> BuildingListChanged; + /// <summary>Raised after NPCs are added or removed in a location.</summary> + event EventHandler<WorldNpcListChangedEventArgs> NpcListChanged; + /// <summary>Raised after objects are added or removed in a location.</summary> event EventHandler<WorldObjectListChangedEventArgs> ObjectListChanged; diff --git a/src/SMAPI/Events/WorldNpcListChangedEventArgs.cs b/src/SMAPI/Events/WorldNpcListChangedEventArgs.cs new file mode 100644 index 00000000..e251f894 --- /dev/null +++ b/src/SMAPI/Events/WorldNpcListChangedEventArgs.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using StardewValley; + +namespace StardewModdingAPI.Events +{ + /// <summary>Event arguments for a <see cref="IWorldEvents.NpcListChanged"/> event.</summary> + public class WorldNpcListChangedEventArgs : EventArgs + { + /********* + ** Accessors + *********/ + /// <summary>The location which changed.</summary> + public GameLocation Location { get; } + + /// <summary>The NPCs added to the location.</summary> + public IEnumerable<NPC> Added { get; } + + /// <summary>The NPCs removed from the location.</summary> + public IEnumerable<NPC> Removed { get; } + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="location">The location which changed.</param> + /// <param name="added">The NPCs added to the location.</param> + /// <param name="removed">The NPCs removed from the location.</param> + public WorldNpcListChangedEventArgs(GameLocation location, IEnumerable<NPC> added, IEnumerable<NPC> removed) + { + this.Location = location; + this.Added = added.ToArray(); + this.Removed = removed.ToArray(); + } + } +} |