summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Events/ModSpecialisedEvents.cs
blob: 17c32bb8d75f0fe42b13dfcdf62bdb6c33723522 (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
using System;
using StardewModdingAPI.Events;

namespace StardewModdingAPI.Framework.Events
{
    /// <summary>Events serving specialised edge cases that shouldn't be used by most mods.</summary>
    internal class ModSpecialisedEvents : ModEventsBase, ISpecialisedEvents
    {
        /*********
        ** Accessors
        *********/
        /// <summary>Raised before the game state is updated (≈60 times per second), regardless of normal SMAPI validation. This event is not thread-safe and may be invoked while game logic is running asynchronously. Changes to game state in this method may crash the game or corrupt an in-progress save. Do not use this event unless you're fully aware of the context in which your code will be run. Mods using this event will trigger a stability warning in the SMAPI console.</summary>
        public event EventHandler<UnvalidatedUpdateTickingEventArgs> UnvalidatedUpdateTicking
        {
            add => this.EventManager.UnvalidatedUpdateTicking.Add(value);
            remove => this.EventManager.UnvalidatedUpdateTicking.Remove(value);
        }

        /// <summary>Raised after the game state is updated (≈60 times per second), regardless of normal SMAPI validation. This event is not thread-safe and may be invoked while game logic is running asynchronously. Changes to game state in this method may crash the game or corrupt an in-progress save. Do not use this event unless you're fully aware of the context in which your code will be run. Mods using this event will trigger a stability warning in the SMAPI console.</summary>
        public event EventHandler<UnvalidatedUpdateTickedEventArgs> UnvalidatedUpdateTicked
        {
            add => this.EventManager.UnvalidatedUpdateTicked.Add(value);
            remove => this.EventManager.UnvalidatedUpdateTicked.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 ModSpecialisedEvents(IModMetadata mod, EventManager eventManager)
            : base(mod, eventManager) { }
    }
}