From 8fd2a6fd3a3de037055ccd8ec350c92ba2cdda9d Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 22 Jan 2021 20:17:01 -0500 Subject: [PATCH] update for new map override logic in SDV 1.5.4 Special thanks to the Stardew Valley developers for making the requested changes! --- docs/release-notes.md | 4 +++- src/SMAPI/Constants.cs | 2 +- src/SMAPI/Metadata/CoreAssetPropagator.cs | 26 ++--------------------- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index 58bc2826..0d5fdea4 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -9,10 +9,12 @@ ## Upcoming release * For players: + * Updated for Stardew Valley 1.5.4. * Improved game detection in the installer: * The installer now prefers paths registered by Steam or GOG Galaxy. * The installer now detects default manual GOG installs. * Added clearer error when Vortex creates an empty mod folder. + * Fixed various cases where the game's map changes wouldn't be reapplied correctly after mods changed the map. * Fixed compatibility for very old content packs which still load maps from `.xnb` files. These were broken by map loading changes in Stardew Valley 1.5, but SMAPI now corrects them automatically. * Fixed some broken mods incorrectly listed as XNB mods under 'skipped mods'. @@ -28,7 +30,7 @@ * Network messages through the multiplayer API are no longer sent to players who don't have SMAPI installed. This reduces unneeded network traffic (since they can't read it anyway) and avoids an error in some cases. * Improved asset propagation: * Added propagation for some `Strings\StringsFromCSFiles` keys (mainly short day names). - * Fixed some of the game's map changes not reapplied after reloading a map in Stardew Valley 1.5. + * Updated map propagation for the changes in Stardew Valley 1.5.4. * Fixed quarry bridge not fixed if the mountain map was reloaded. * Added an option to disable rewriting mods for compatibility (thanks to Bpendragon!). This prevents older mods from loading but bypasses a Visual Studio debugger crash. * Game errors shown in the chatbox are now logged. diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index b72471ca..36745ea7 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -57,7 +57,7 @@ namespace StardewModdingAPI public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.8.4"); /// The minimum supported version of Stardew Valley. - public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.5.3"); + public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.5.4"); /// The maximum supported version of Stardew Valley. public static ISemanticVersion MaximumGameVersion { get; } = null; diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index 859a1b7a..4b911a83 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -784,32 +784,10 @@ namespace StardewModdingAPI.Metadata /// The location whose map to reload. private void ReloadMap(GameLocation location) { - // reset patch caches - this.Reflection.GetField>(location, "_appliedMapOverrides").GetValue().Clear(); - switch (location) - { - case Town _: - this.Reflection.GetField(location, "ccRefurbished").SetValue(false); - this.Reflection.GetField(location, "isShowingDestroyedJoja").SetValue(false); - this.Reflection.GetField(location, "isShowingSpecialOrdersBoard").SetValue(false); - this.Reflection.GetField(location, "isShowingUpgradedPamHouse").SetValue(false); - break; - - case Beach _: - case BeachNightMarket _: - case Forest _: - this.Reflection.GetField(location, "hasShownCCUpgrade").SetValue(false); - break; - - case Mountain _: - this.Reflection.GetField(location, "bridgeRestored").SetValue(false); - break; - } - - // general updates + // reload map location.reloadMap(); - location.updateSeasonalTileSheets(); location.updateWarps(); + location.MakeMapModifications(force: true); // update interior doors location.interiorDoors.Clear();