summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI/Framework')
-rw-r--r--src/StardewModdingAPI/Framework/Monitor.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/Framework/Monitor.cs b/src/StardewModdingAPI/Framework/Monitor.cs
index 4fe1df04..cf46a474 100644
--- a/src/StardewModdingAPI/Framework/Monitor.cs
+++ b/src/StardewModdingAPI/Framework/Monitor.cs
@@ -65,6 +65,22 @@ namespace StardewModdingAPI.Framework
this.LogImpl(this.Source, message, Monitor.Colors[level], level);
}
+ /// <summary>Immediately exit the game without saving. This should only be invoked when an irrecoverable fatal error happens that risks save corruption or game-breaking bugs.</summary>
+ /// <param name="reason">The reason for the shutdown.</param>
+ public void ExitGameImmediately(string reason)
+ {
+ Program.ExitGameImmediately(this.Source, reason);
+ Program.gamePtr.Exit();
+ }
+
+ /// <summary>Log a fatal error message.</summary>
+ /// <param name="message">The message to log.</param>
+ internal void LogFatal(string message)
+ {
+ Console.BackgroundColor = ConsoleColor.Red;
+ this.LogImpl(this.Source, message, ConsoleColor.White, LogLevel.Error);
+ }
+
/// <summary>Log a message for the player or developer, using the specified console color.</summary>
/// <param name="source">The name of the mod logging the message.</param>
/// <param name="message">The message to log.</param>