using StardewValley; using StardewValley.Menus; namespace StardewModdingAPI { /// Provides information about the current game state. public static class Context { /********* ** Accessors *********/ /**** ** Public ****/ /// Whether the player has loaded a save and the world has finished initialising. public static bool IsWorldReady { get; internal set; } /**** ** Internal ****/ /// Whether a player save has been loaded. internal static bool IsSaveLoaded => Game1.hasLoadedGame && !string.IsNullOrEmpty(Game1.player.name); /// Whether the game is currently writing to the save file. internal static bool IsSaving => Game1.activeClickableMenu is SaveGameMenu || Game1.activeClickableMenu is ShippingMenu; // saving is performed by SaveGameMenu, but it's wrapped by ShippingMenu on days when the player shipping something /// Whether the game is currently running the draw loop. internal static bool IsInDrawLoop { get; set; } } }