diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-01-15 18:34:05 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-01-15 18:34:05 -0500 |
commit | 5953fc3bd083ae0a579d2da1ad833e6163848086 (patch) | |
tree | fb4b0ec17ac2627b61624edba23b714a31eecd6f /src/SMAPI/Metadata | |
parent | bdb7b04b3edecdf7dfa665d8b5a50a1bbff62699 (diff) | |
parent | 415047bf8e44057d6aeeffc6191d00817f6b0d1b (diff) | |
download | SMAPI-5953fc3bd083ae0a579d2da1ad833e6163848086.tar.gz SMAPI-5953fc3bd083ae0a579d2da1ad833e6163848086.tar.bz2 SMAPI-5953fc3bd083ae0a579d2da1ad833e6163848086.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Metadata')
-rw-r--r-- | src/SMAPI/Metadata/CoreAssetPropagator.cs | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index b82dedfd..bd1cc50e 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -138,36 +138,7 @@ namespace StardewModdingAPI.Metadata { if (!string.IsNullOrWhiteSpace(location.mapPath.Value) && this.NormalizeAssetNameIgnoringEmpty(location.mapPath.Value) == key) { - // reset patch caches - switch (location) - { - case Town _: - this.Reflection.GetField<bool>(location, "ccRefurbished").SetValue(false); - this.Reflection.GetField<bool>(location, "isShowingDestroyedJoja").SetValue(false); - this.Reflection.GetField<bool>(location, "isShowingUpgradedPamHouse").SetValue(false); - break; - - case Beach _: - case BeachNightMarket _: - case Forest _: - this.Reflection.GetField<bool>(location, "hasShownCCUpgrade").SetValue(false); - break; - } - - // general updates - location.reloadMap(); - location.updateSeasonalTileSheets(); - location.updateWarps(); - - // update interior doors - location.interiorDoors.Clear(); - foreach (var entry in new InteriorDoorDictionary(location)) - location.interiorDoors.Add(entry); - - // update doors - location.doors.Clear(); - location.updateDoors(); - + this.ReloadMap(location); anyChanged = true; } } @@ -803,6 +774,41 @@ namespace StardewModdingAPI.Metadata return true; } + /// <summary>Reload the map for a location.</summary> + /// <param name="location">The location whose map to reload.</param> + private void ReloadMap(GameLocation location) + { + // reset patch caches + switch (location) + { + case Town _: + this.Reflection.GetField<bool>(location, "ccRefurbished").SetValue(false); + this.Reflection.GetField<bool>(location, "isShowingDestroyedJoja").SetValue(false); + this.Reflection.GetField<bool>(location, "isShowingUpgradedPamHouse").SetValue(false); + break; + + case Beach _: + case BeachNightMarket _: + case Forest _: + this.Reflection.GetField<bool>(location, "hasShownCCUpgrade").SetValue(false); + break; + } + + // general updates + location.reloadMap(); + location.updateSeasonalTileSheets(); + location.updateWarps(); + + // update interior doors + location.interiorDoors.Clear(); + foreach (var entry in new InteriorDoorDictionary(location)) + location.interiorDoors.Add(entry); + + // update doors + location.doors.Clear(); + location.updateDoors(); + } + /// <summary>Reload the disposition data for matching NPCs.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> |