summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Events/ModWorldEvents.cs
blob: 2ae69669db93cf45a46d6fb37fdcbd866b17c95a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using StardewModdingAPI.Events;

namespace StardewModdingAPI.Framework.Events
{
    /// <summary>Events raised when something changes in the world.</summary>
    internal class ModWorldEvents : ModEventsBase, IWorldEvents
    {
        /*********
        ** Accessors
        *********/
        /// <summary>Raised after a game location is added or removed.</summary>
        public event EventHandler<LocationListChangedEventArgs> LocationListChanged
        {
            add => this.EventManager.LocationListChanged.Add(value, this.Mod);
            remove => this.EventManager.LocationListChanged.Remove(value);
        }

        /// <summary>Raised after buildings are added or removed in a location.</summary>
        public event EventHandler<BuildingListChangedEventArgs> BuildingListChanged
        {
            add => this.EventManager.BuildingListChanged.Add(value, this.Mod);
            remove => this.EventManager.BuildingListChanged.Remove(value);
        }

        /// <summary>Raised after debris are added or removed in a location.</summary>
        public event EventHandler<DebrisListChangedEventArgs> DebrisListChanged
        {
            add => this.EventManager.DebrisListChanged.Add(value, this.Mod);
            remove => this.EventManager.DebrisListChanged.Remove(value);
        }

        /// <summary>Raised after large terrain features (like bushes) are added or removed in a location.</summary>
        public event EventHandler<LargeTerrainFeatureListChangedEventArgs> LargeTerrainFeatureListChanged
        {
            add => this.EventManager.LargeTerrainFeatureListChanged.Add(value, this.Mod);
            remove => this.EventManager.LargeTerrainFeatureListChanged.Remove(value);
        }

        /// <summary>Raised after NPCs are added or removed in a location.</summary>
        public event EventHandler<NpcListChangedEventArgs> NpcListChanged
        {
            add => this.EventManager.NpcListChanged.Add(value);
            remove => this.EventManager.NpcListChanged.Remove(value);
        }

        /// <summary>Raised after objects are added or removed in a location.</summary>
        public event EventHandler<ObjectListChangedEventArgs> ObjectListChanged
        {
            add => this.EventManager.ObjectListChanged.Add(value);
            remove => this.EventManager.ObjectListChanged.Remove(value);
        }

        /// <summary>Raised after items are added or removed from a chest.</summary>
        public event EventHandler<ChestInventoryChangedEventArgs> ChestInventoryChanged
        {
            add => this.EventManager.ChestInventoryChanged.Add(value);
            remove => this.EventManager.ChestInventoryChanged.Remove(value);
        }

        /// <summary>Raised after terrain features (like floors and trees) are added or removed in a location.</summary>
        public event EventHandler<TerrainFeatureListChangedEventArgs> TerrainFeatureListChanged
        {
            add => this.EventManager.TerrainFeatureListChanged.Add(value);
            remove => this.EventManager.TerrainFeatureListChanged.Remove(value);
        }


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="mod">The mod which uses this instance.</param>
        /// <param name="eventManager">The underlying event manager.</param>
        internal ModWorldEvents(IModMetadata mod, EventManager eventManager)
            : base(mod, eventManager) { }
    }
}