summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-05-27 23:48:16 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-05-27 23:48:16 -0400
commit173dd8cd030992983ddea36c944f22f7ad6ed9bd (patch)
tree28d167bf638cfac8f58025a81033e7acf34122af /src
parent55fa8198ffc140237e1041056f3a4d8f4e7469c8 (diff)
downloadSMAPI-173dd8cd030992983ddea36c944f22f7ad6ed9bd.tar.gz
SMAPI-173dd8cd030992983ddea36c944f22f7ad6ed9bd.tar.bz2
SMAPI-173dd8cd030992983ddea36c944f22f7ad6ed9bd.zip
add Context.IsPlayerFree
Diffstat (limited to 'src')
-rw-r--r--src/StardewModdingAPI/Context.cs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/Context.cs b/src/StardewModdingAPI/Context.cs
index 3fe70c68..6c5ae40e 100644
--- a/src/StardewModdingAPI/Context.cs
+++ b/src/StardewModdingAPI/Context.cs
@@ -16,6 +16,9 @@ namespace StardewModdingAPI
/// <summary>Whether the player has loaded a save and the world has finished initialising.</summary>
public static bool IsWorldReady { get; internal set; }
+ /// <summary>Whether the player is free to move around (e.g. save is loaded, no menu is displayed, no cutscene is in progress, etc).</summary>
+ public static bool IsPlayerFree => Context.IsWorldReady && Game1.activeClickableMenu == null && Game1.player.CanMove && !Game1.dialogueUp && !Game1.eventUp;
+
/// <summary>Whether the game is currently running the draw loop. This isn't relevant to most mods, since you should use <see cref="GraphicsEvents.OnPostRenderEvent"/> to draw to the screen.</summary>
public static bool IsInDrawLoop { get; internal set; }