summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r--src/SMAPI/Events/IWorldEvents.cs3
-rw-r--r--src/SMAPI/Events/WorldTerrainFeatureListChangedEventArgs.cs40
2 files changed, 43 insertions, 0 deletions
diff --git a/src/SMAPI/Events/IWorldEvents.cs b/src/SMAPI/Events/IWorldEvents.cs
index a9a5fe6b..7ec26bae 100644
--- a/src/SMAPI/Events/IWorldEvents.cs
+++ b/src/SMAPI/Events/IWorldEvents.cs
@@ -16,5 +16,8 @@ namespace StardewModdingAPI.Events
/// <summary>Raised after objects are added or removed in a location.</summary>
event EventHandler<WorldObjectListChangedEventArgs> ObjectListChanged;
+
+ /// <summary>Raised after terrain features are added or removed in a location.</summary>
+ event EventHandler<WorldTerrainFeatureListChangedEventArgs> TerrainFeatureListChanged;
}
}
diff --git a/src/SMAPI/Events/WorldTerrainFeatureListChangedEventArgs.cs b/src/SMAPI/Events/WorldTerrainFeatureListChangedEventArgs.cs
new file mode 100644
index 00000000..cb089811
--- /dev/null
+++ b/src/SMAPI/Events/WorldTerrainFeatureListChangedEventArgs.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Xna.Framework;
+using StardewValley;
+using StardewValley.TerrainFeatures;
+
+namespace StardewModdingAPI.Events
+{
+ /// <summary>Event arguments for a <see cref="IWorldEvents.TerrainFeatureListChanged"/> event.</summary>
+ public class WorldTerrainFeatureListChangedEventArgs : EventArgs
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The location which changed.</summary>
+ public GameLocation Location { get; }
+
+ /// <summary>The terrain features added to the location.</summary>
+ public IEnumerable<KeyValuePair<Vector2, TerrainFeature>> Added { get; }
+
+ /// <summary>The terrain features removed from the location.</summary>
+ public IEnumerable<KeyValuePair<Vector2, TerrainFeature>> Removed { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="location">The location which changed.</param>
+ /// <param name="added">The terrain features added to the location.</param>
+ /// <param name="removed">The terrain features removed from the location.</param>
+ public WorldTerrainFeatureListChangedEventArgs(GameLocation location, IEnumerable<KeyValuePair<Vector2, TerrainFeature>> added, IEnumerable<KeyValuePair<Vector2, TerrainFeature>> removed)
+ {
+ this.Location = location;
+ this.Added = added.ToArray();
+ this.Removed = removed.ToArray();
+ }
+ }
+}