summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/StateTracking
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-06-01 02:14:01 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-06-01 02:14:01 -0400
commit07bbfea7dd9dac5bbacf8bfc3c35d3f65ec71b75 (patch)
tree073ce173468e3e26b6a9e7a61696ad2baeb7c59b /src/SMAPI/Framework/StateTracking
parentb3f116a8f123387b1f2f9ce1a099d1fd8081708d (diff)
downloadSMAPI-07bbfea7dd9dac5bbacf8bfc3c35d3f65ec71b75.tar.gz
SMAPI-07bbfea7dd9dac5bbacf8bfc3c35d3f65ec71b75.tar.bz2
SMAPI-07bbfea7dd9dac5bbacf8bfc3c35d3f65ec71b75.zip
add NPC list changed event (#310)
Diffstat (limited to 'src/SMAPI/Framework/StateTracking')
-rw-r--r--src/SMAPI/Framework/StateTracking/LocationTracker.cs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/StateTracking/LocationTracker.cs b/src/SMAPI/Framework/StateTracking/LocationTracker.cs
index d31b1128..4ac455ac 100644
--- a/src/SMAPI/Framework/StateTracking/LocationTracker.cs
+++ b/src/SMAPI/Framework/StateTracking/LocationTracker.cs
@@ -33,6 +33,9 @@ namespace StardewModdingAPI.Framework.StateTracking
/// <summary>Tracks added or removed buildings.</summary>
public ICollectionWatcher<Building> BuildingsWatcher { get; }
+ /// <summary>Tracks added or removed NPCs.</summary>
+ public ICollectionWatcher<NPC> NpcsWatcher { get; }
+
/// <summary>Tracks added or removed objects.</summary>
public IDictionaryWatcher<Vector2, Object> ObjectsWatcher { get; }
@@ -50,15 +53,17 @@ namespace StardewModdingAPI.Framework.StateTracking
this.Location = location;
// init watchers
- this.ObjectsWatcher = WatcherFactory.ForNetDictionary(location.netObjects);
this.BuildingsWatcher = location is BuildableGameLocation buildableLocation
? WatcherFactory.ForNetCollection(buildableLocation.buildings)
: (ICollectionWatcher<Building>)WatcherFactory.ForObservableCollection(new ObservableCollection<Building>());
+ this.NpcsWatcher = WatcherFactory.ForNetCollection(location.characters);
+ this.ObjectsWatcher = WatcherFactory.ForNetDictionary(location.netObjects);
this.TerrainFeaturesWatcher = WatcherFactory.ForNetDictionary(location.terrainFeatures);
this.Watchers.AddRange(new IWatcher[]
{
this.BuildingsWatcher,
+ this.NpcsWatcher,
this.ObjectsWatcher,
this.TerrainFeaturesWatcher
});