diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-10-24 19:27:00 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-10-24 19:27:00 -0400 |
commit | 68e33c653ad780f75df6642b78feca015e8dbbb2 (patch) | |
tree | df2da8683a0ca0ca41b2e29a1167b64335265b6e /src/SMAPI/Framework/SGame.cs | |
parent | 8c97a63a82729efe56d73928e9afb436dbffea56 (diff) | |
download | SMAPI-68e33c653ad780f75df6642b78feca015e8dbbb2.tar.gz SMAPI-68e33c653ad780f75df6642b78feca015e8dbbb2.tar.bz2 SMAPI-68e33c653ad780f75df6642b78feca015e8dbbb2.zip |
suppress BeforeSave, AfterSave, and AfterDayStarted events during new-game intro (#374)
Diffstat (limited to 'src/SMAPI/Framework/SGame.cs')
-rw-r--r-- | src/SMAPI/Framework/SGame.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index c62c1393..c886a4b7 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -240,6 +240,9 @@ namespace StardewModdingAPI.Framework return; } + /********* + ** Save events + suppress events during save + *********/ // While the game is writing to the save file in the background, mods can unexpectedly // fail since they don't have exclusive access to resources (e.g. collection changed // during enumeration errors). To avoid problems, events are not invoked while a save @@ -248,7 +251,7 @@ namespace StardewModdingAPI.Framework if (Context.IsSaving) { // raise before-save - if (!this.IsBetweenSaveEvents) + if (Context.IsWorldReady && !this.IsBetweenSaveEvents) { this.IsBetweenSaveEvents = true; this.Monitor.Log("Context: before save.", LogLevel.Trace); |