fix save/load event precedence (#453)
This commit is contained in:
parent
b2c4218e0d
commit
2b2ad7a486
|
@ -236,42 +236,6 @@ namespace StardewModdingAPI.Framework
|
|||
return;
|
||||
}
|
||||
|
||||
/*********
|
||||
** Update context
|
||||
*********/
|
||||
if (Context.IsSaveLoaded && !SaveGame.IsProcessing /*still loading save*/ && this.AfterLoadTimer >= 0)
|
||||
{
|
||||
if (Game1.dayOfMonth != 0) // wait until new-game intro finishes (world not fully initialised yet)
|
||||
this.AfterLoadTimer--;
|
||||
Context.IsWorldReady = this.AfterLoadTimer <= 0;
|
||||
}
|
||||
|
||||
/*********
|
||||
** Update watchers
|
||||
*********/
|
||||
// reset player
|
||||
if (Context.IsWorldReady)
|
||||
{
|
||||
if (this.CurrentPlayerTracker == null || this.CurrentPlayerTracker.Player != Game1.player)
|
||||
{
|
||||
this.CurrentPlayerTracker?.Dispose();
|
||||
this.CurrentPlayerTracker = new PlayerTracker(Game1.player);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.CurrentPlayerTracker != null)
|
||||
{
|
||||
this.CurrentPlayerTracker.Dispose();
|
||||
this.CurrentPlayerTracker = null;
|
||||
}
|
||||
}
|
||||
|
||||
// update values
|
||||
foreach (IWatcher watcher in this.Watchers)
|
||||
watcher.Update();
|
||||
this.CurrentPlayerTracker?.Update();
|
||||
|
||||
/*********
|
||||
** Save events + suppress events during save
|
||||
*********/
|
||||
|
@ -325,6 +289,43 @@ namespace StardewModdingAPI.Framework
|
|||
if (this.FirstUpdate)
|
||||
this.OnGameInitialised();
|
||||
|
||||
|
||||
/*********
|
||||
** Update context
|
||||
*********/
|
||||
if (Context.IsSaveLoaded && !SaveGame.IsProcessing /*still loading save*/ && this.AfterLoadTimer >= 0)
|
||||
{
|
||||
if (Game1.dayOfMonth != 0) // wait until new-game intro finishes (world not fully initialised yet)
|
||||
this.AfterLoadTimer--;
|
||||
Context.IsWorldReady = this.AfterLoadTimer <= 0;
|
||||
}
|
||||
|
||||
/*********
|
||||
** Update watchers
|
||||
*********/
|
||||
// reset player
|
||||
if (Context.IsWorldReady)
|
||||
{
|
||||
if (this.CurrentPlayerTracker == null || this.CurrentPlayerTracker.Player != Game1.player)
|
||||
{
|
||||
this.CurrentPlayerTracker?.Dispose();
|
||||
this.CurrentPlayerTracker = new PlayerTracker(Game1.player);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.CurrentPlayerTracker != null)
|
||||
{
|
||||
this.CurrentPlayerTracker.Dispose();
|
||||
this.CurrentPlayerTracker = null;
|
||||
}
|
||||
}
|
||||
|
||||
// update values
|
||||
foreach (IWatcher watcher in this.Watchers)
|
||||
watcher.Update();
|
||||
this.CurrentPlayerTracker?.Update();
|
||||
|
||||
/*********
|
||||
** Locale changed events
|
||||
*********/
|
||||
|
|
Loading…
Reference in New Issue