diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-17 14:30:57 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-17 14:30:57 -0400 |
commit | 228f84eea60e9a2c0eb6abd167ae173a7332974d (patch) | |
tree | 250d78baa47a0c202231698c887c1bac75bcbb45 /src/StardewModdingAPI/Framework | |
parent | 0b853ca18df1391d919999f4d30d7e26f7f9648f (diff) | |
download | SMAPI-228f84eea60e9a2c0eb6abd167ae173a7332974d.tar.gz SMAPI-228f84eea60e9a2c0eb6abd167ae173a7332974d.tar.bz2 SMAPI-228f84eea60e9a2c0eb6abd167ae173a7332974d.zip |
raise location/player changed events on load
Diffstat (limited to 'src/StardewModdingAPI/Framework')
-rw-r--r-- | src/StardewModdingAPI/Framework/SGame.cs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/StardewModdingAPI/Framework/SGame.cs b/src/StardewModdingAPI/Framework/SGame.cs index 36722339..87f46523 100644 --- a/src/StardewModdingAPI/Framework/SGame.cs +++ b/src/StardewModdingAPI/Framework/SGame.cs @@ -438,25 +438,25 @@ namespace StardewModdingAPI.Framework *********/ if (Context.IsWorldReady) { - // raise events (only when something changes, not on the initial load) + // raise current location changed + if (Game1.currentLocation != this.PreviousGameLocation) + { + if (this.VerboseLogging) + this.Monitor.Log($"Context: set location to {Game1.currentLocation?.Name ?? "(none)"}.", LogLevel.Trace); + LocationEvents.InvokeCurrentLocationChanged(this.Monitor, this.PreviousGameLocation, Game1.currentLocation); + } + + // raise player changed + if (Game1.player != this.PreviousFarmer) + PlayerEvents.InvokeFarmerChanged(this.Monitor, this.PreviousFarmer, Game1.player); + + // raise events that shouldn't be triggered on initial load if (Game1.uniqueIDForThisGame == this.PreviousSaveID) { // raise location list changed if (this.GetHash(Game1.locations) != this.PreviousGameLocations) LocationEvents.InvokeLocationsChanged(this.Monitor, Game1.locations); - // raise current location changed - if (Game1.currentLocation != this.PreviousGameLocation) - { - if (this.VerboseLogging) - this.Monitor.Log($"Context: set location to {Game1.currentLocation?.Name ?? "(none)"}.", LogLevel.Trace); - LocationEvents.InvokeCurrentLocationChanged(this.Monitor, this.PreviousGameLocation, Game1.currentLocation); - } - - // raise player changed - if (Game1.player != this.PreviousFarmer) - PlayerEvents.InvokeFarmerChanged(this.Monitor, this.PreviousFarmer, Game1.player); - // raise player leveled up a skill if (Game1.player.combatLevel != this.PreviousCombatLevel) PlayerEvents.InvokeLeveledUp(this.Monitor, EventArgsLevelUp.LevelType.Combat, Game1.player.combatLevel); |