using System.Collections.Generic;
using Microsoft.Xna.Framework;
using StardewValley;
using StardewValley.Buildings;
using StardewValley.TerrainFeatures;
namespace StardewModdingAPI.Framework.StateTracking.Snapshots
{
/// A frozen snapshot of a tracked game location.
internal class LocationSnapshot
{
/*********
** Accessors
*********/
/// The tracked location.
public GameLocation Location { get; }
/// Tracks added or removed buildings.
public SnapshotListDiff Buildings { get; } = new SnapshotListDiff();
/// Tracks added or removed debris.
public SnapshotListDiff Debris { get; } = new SnapshotListDiff();
/// Tracks added or removed large terrain features.
public SnapshotListDiff LargeTerrainFeatures { get; } = new SnapshotListDiff();
/// Tracks added or removed NPCs.
public SnapshotListDiff Npcs { get; } = new SnapshotListDiff();
/// Tracks added or removed objects.
public SnapshotListDiff> Objects { get; } = new SnapshotListDiff>();
/// Tracks added or removed terrain features.
public SnapshotListDiff> TerrainFeatures { get; } = new SnapshotListDiff>();
/*********
** Public methods
*********/
/// Construct an instance.
/// The tracked location.
public LocationSnapshot(GameLocation location)
{
this.Location = location;
}
/// Update the tracked values.
/// The watcher to snapshot.
public void Update(LocationTracker watcher)
{
this.Buildings.Update(watcher.BuildingsWatcher);
this.Debris.Update(watcher.DebrisWatcher);
this.LargeTerrainFeatures.Update(watcher.LargeTerrainFeaturesWatcher);
this.Npcs.Update(watcher.NpcsWatcher);
this.Objects.Update(watcher.ObjectsWatcher);
this.TerrainFeatures.Update(watcher.TerrainFeaturesWatcher);
}
}
}