diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-09-25 20:22:26 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-09-25 20:22:26 -0400 |
commit | 31e31538f128f2a79b553a2cc20fe8a6f13e8a06 (patch) | |
tree | b037049c3bb28014c3cef7f1994cb25168b99b7c /src/SMAPI/Metadata | |
parent | 0e3e4f565ad4cda17759f2ebf9a8d35d4a8252b8 (diff) | |
download | SMAPI-31e31538f128f2a79b553a2cc20fe8a6f13e8a06.tar.gz SMAPI-31e31538f128f2a79b553a2cc20fe8a6f13e8a06.tar.bz2 SMAPI-31e31538f128f2a79b553a2cc20fe8a6f13e8a06.zip |
fix farmhouse edits shifting player down one tile
Diffstat (limited to 'src/SMAPI/Metadata')
-rw-r--r-- | src/SMAPI/Metadata/CoreAssetPropagator.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index 35ae26b3..8bf7a32b 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using StardewModdingAPI.Framework.ContentManagers; using StardewModdingAPI.Framework.Reflection; @@ -908,6 +909,8 @@ namespace StardewModdingAPI.Metadata /// <param name="location">The location whose map to reload.</param> private void ReloadMap(GameLocation location) { + Vector2? playerPos = Game1.player?.Position; + if (this.AggressiveMemoryOptimizations) location.map.DisposeTileSheets(Game1.mapDisplayDevice); @@ -926,6 +929,14 @@ namespace StardewModdingAPI.Metadata // update for changes location.updateWarps(); location.updateDoors(); + + // reset player position + // The game may move the player as part of the map changes, even if they're not in that + // location. That's not needed in this case, and it can have weird effects like players + // warping onto the wrong tile (or even off-screen) if a patch changes the farmhouse + // map on location change. + if (playerPos.HasValue) + Game1.player.Position = playerPos.Value; } /// <summary>Reload the disposition data for matching NPCs.</summary> |