diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-07-09 22:30:13 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-07-09 22:30:13 -0400 |
commit | 8f96a97f070d654764de3b138678d8f62707f485 (patch) | |
tree | 9a59953e01bfc27d0f124579ae897fabec46092f /src/SMAPI/Events | |
parent | 7dd3e37dec6924b1acd3f3045aefe5ebc8f91e8f (diff) | |
parent | 60af28760a6edc509b16e7c62aa8b00ba9798793 (diff) | |
download | SMAPI-8f96a97f070d654764de3b138678d8f62707f485.tar.gz SMAPI-8f96a97f070d654764de3b138678d8f62707f485.tar.bz2 SMAPI-8f96a97f070d654764de3b138678d8f62707f485.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r-- | src/SMAPI/Events/FurnitureListChangedEventArgs.cs | 42 | ||||
-rw-r--r-- | src/SMAPI/Events/IWorldEvents.cs | 3 |
2 files changed, 45 insertions, 0 deletions
diff --git a/src/SMAPI/Events/FurnitureListChangedEventArgs.cs b/src/SMAPI/Events/FurnitureListChangedEventArgs.cs new file mode 100644 index 00000000..683f4620 --- /dev/null +++ b/src/SMAPI/Events/FurnitureListChangedEventArgs.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using StardewValley; +using StardewValley.Objects; + +namespace StardewModdingAPI.Events +{ + /// <summary>Event arguments for a <see cref="IWorldEvents.FurnitureListChanged"/> event.</summary> + public class FurnitureListChangedEventArgs : EventArgs + { + /********* + ** Accessors + *********/ + /// <summary>The location which changed.</summary> + public GameLocation Location { get; } + + /// <summary>The furniture added to the location.</summary> + public IEnumerable<Furniture> Added { get; } + + /// <summary>The furniture removed from the location.</summary> + public IEnumerable<Furniture> Removed { get; } + + /// <summary>Whether this is the location containing the local player.</summary> + public bool IsCurrentLocation => object.ReferenceEquals(this.Location, Game1.player?.currentLocation); + + + /********* + ** Public methods + *********/ + /// <summary>Construct an instance.</summary> + /// <param name="location">The location which changed.</param> + /// <param name="added">The furniture added to the location.</param> + /// <param name="removed">The furniture removed from the location.</param> + internal FurnitureListChangedEventArgs(GameLocation location, IEnumerable<Furniture> added, IEnumerable<Furniture> removed) + { + this.Location = location; + this.Added = added.ToArray(); + this.Removed = removed.ToArray(); + } + } +} diff --git a/src/SMAPI/Events/IWorldEvents.cs b/src/SMAPI/Events/IWorldEvents.cs index 9569a57b..c023e1f0 100644 --- a/src/SMAPI/Events/IWorldEvents.cs +++ b/src/SMAPI/Events/IWorldEvents.cs @@ -28,5 +28,8 @@ namespace StardewModdingAPI.Events /// <summary>Raised after terrain features (like floors and trees) are added or removed in a location.</summary> event EventHandler<TerrainFeatureListChangedEventArgs> TerrainFeatureListChanged; + + /// <summary>Raised after furniture are added or removed in a location.</summary> + event EventHandler<FurnitureListChangedEventArgs> FurnitureListChanged; } } |