From cb6f6fe19d51acd995e33bc04c3bf243c05e34da Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 19 Nov 2016 16:03:45 -0500 Subject: fix race condition where GameLoaded event was sometime fired before the game was ready --- src/StardewModdingAPI/Inheritance/SGame.cs | 4 ++++ src/StardewModdingAPI/Program.cs | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/StardewModdingAPI') diff --git a/src/StardewModdingAPI/Inheritance/SGame.cs b/src/StardewModdingAPI/Inheritance/SGame.cs index 3471d01b..ed5df125 100644 --- a/src/StardewModdingAPI/Inheritance/SGame.cs +++ b/src/StardewModdingAPI/Inheritance/SGame.cs @@ -316,6 +316,10 @@ namespace StardewModdingAPI.Inheritance // add FPS to debug output SGame.QueueDebugMessage($"FPS: {SGame.FramesPerSecond}"); + // raise game loaded + if (this.FirstUpdate) + GameEvents.InvokeGameLoaded(); + // update SMAPI events this.UpdateEventCalls(); diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index 4268a944..f3751462 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -230,9 +230,6 @@ namespace StardewModdingAPI // register help command Command.RegisterCommand("help", "Lists all commands | 'help ' returns command description").CommandFired += Program.help_CommandFired; - // raise game loaded event - GameEvents.InvokeGameLoaded(); - // listen for command line input Program.Monitor.Log("Starting console..."); Program.Monitor.Log("Type 'help' for help, or 'help ' for a command's usage", LogLevel.Info); -- cgit