summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-09-25 20:22:26 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-09-25 20:22:26 -0400
commit31e31538f128f2a79b553a2cc20fe8a6f13e8a06 (patch)
treeb037049c3bb28014c3cef7f1994cb25168b99b7c
parent0e3e4f565ad4cda17759f2ebf9a8d35d4a8252b8 (diff)
downloadSMAPI-31e31538f128f2a79b553a2cc20fe8a6f13e8a06.tar.gz
SMAPI-31e31538f128f2a79b553a2cc20fe8a6f13e8a06.tar.bz2
SMAPI-31e31538f128f2a79b553a2cc20fe8a6f13e8a06.zip
fix farmhouse edits shifting player down one tile
-rw-r--r--docs/release-notes.md4
-rw-r--r--src/SMAPI/Metadata/CoreAssetPropagator.cs11
2 files changed, 15 insertions, 0 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index 8ed155bd..25698ffa 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -1,6 +1,10 @@
← [README](README.md)
# Release notes
+## Upcoming release
+* For players:
+ * Fixed mod edits to the farmhouse shifting the player down one tile in some cases.
+
## 3.12.7
Released 18 September 2021 for Stardew Valley 1.5.4.
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>