summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/release-notes.md1
-rw-r--r--src/SMAPI/Metadata/CoreAssetPropagator.cs31
2 files changed, 31 insertions, 1 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index 2cb477fd..b7cd61c6 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -19,6 +19,7 @@ These changes have not been released yet.
* Fixed lag in some cases due to incorrect asset caching when playing in non-English.
* Fixed lag when a mod invalidates many NPC portraits/sprites at once.
* Fixed map reloads resetting tilesheet seasons.
+ * Fixed map reloads not updating door warps.
* Fixed outdoor tilesheets being seasonalised when added to an indoor location.
* For modders:
diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs
index bb269643..186cd4ee 100644
--- a/src/SMAPI/Metadata/CoreAssetPropagator.cs
+++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewModdingAPI.Framework.Reflection;
using StardewValley;
@@ -14,6 +15,7 @@ using StardewValley.Objects;
using StardewValley.Projectiles;
using StardewValley.TerrainFeatures;
using xTile;
+using xTile.ObjectModel;
using xTile.Tiles;
namespace StardewModdingAPI.Metadata
@@ -138,10 +140,37 @@ namespace StardewModdingAPI.Metadata
{
if (!string.IsNullOrWhiteSpace(location.mapPath.Value) && this.GetNormalisedPath(location.mapPath.Value) == key)
{
+ // general updates
location.reloadMap();
location.updateSeasonalTileSheets();
location.updateWarps();
- this.Reflection.GetField<InteriorDoorDictionary>(location, nameof(location.interiorDoors)).SetValue(new InteriorDoorDictionary(location));
+
+ // update interior doors
+ location.interiorDoors.Clear();
+ foreach (var entry in new InteriorDoorDictionary(location))
+ location.interiorDoors.Add(entry);
+
+ // update doors (derived from GameLocation.loadObjects)
+ location.doors.Clear();
+ for (int x = 0; x < location.map.Layers[0].LayerWidth; ++x)
+ {
+ for (int y = 0; y < location.map.Layers[0].LayerHeight; ++y)
+ {
+ if (location.map.GetLayer("Buildings").Tiles[x, y] != null)
+ {
+ location.map.GetLayer("Buildings").Tiles[x, y].Properties.TryGetValue("Action", out PropertyValue action);
+ if (action != null && action.ToString().Contains("Warp"))
+ {
+ string[] strArray = action.ToString().Split(' ');
+ if (strArray[0] == "WarpCommunityCenter")
+ location.doors.Add(new Point(x, y), "CommunityCenter");
+ else if ((location.Name != "Mountain" || x != 8 || y != 20) && strArray.Length > 2)
+ location.doors.Add(new Point(x, y), strArray[3]);
+ }
+ }
+ }
+ }
+
anyChanged = true;
}
}