diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-02-19 19:32:27 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-02-19 19:32:27 -0500 |
commit | 674618664a72679812c1b51065f725fec99aa86d (patch) | |
tree | d511d598bf0adfcf38817d3fd7098bb3854e5863 /src/SMAPI/Events | |
parent | 5060739d62dfce0c72a5d3eeb93332aad7aa929f (diff) | |
download | SMAPI-674618664a72679812c1b51065f725fec99aa86d.tar.gz SMAPI-674618664a72679812c1b51065f725fec99aa86d.tar.bz2 SMAPI-674618664a72679812c1b51065f725fec99aa86d.zip |
add unvalidated update tick event for specialised use cases (#446)
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r-- | src/SMAPI/Events/SpecialisedEvents.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/SMAPI/Events/SpecialisedEvents.cs b/src/SMAPI/Events/SpecialisedEvents.cs new file mode 100644 index 00000000..2a36e6e4 --- /dev/null +++ b/src/SMAPI/Events/SpecialisedEvents.cs @@ -0,0 +1,26 @@ +using System; +using StardewModdingAPI.Framework; + +namespace StardewModdingAPI.Events +{ + /// <summary>Events serving specialised edge cases that shouldn't be used by most mod.</summary> + public static class SpecialisedEvents + { + /********* + ** Events + *********/ + /// <summary>Raised when the game updates its state (≈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 method will trigger a stability warning in the SMAPI console.</summary> + public static event EventHandler UnvalidatedUpdateTick; + + + /********* + ** Internal methods + *********/ + /// <summary>Raise an <see cref="UnvalidatedUpdateTick"/> event.</summary> + /// <param name="monitor">Encapsulates logging and monitoring.</param> + internal static void InvokeUnvalidatedUpdateTick(IMonitor monitor) + { + monitor.SafelyRaisePlainEvent($"{nameof(SpecialisedEvents)}.{nameof(SpecialisedEvents.UnvalidatedUpdateTick)}", SpecialisedEvents.UnvalidatedUpdateTick?.GetInvocationList()); + } + } +} |