diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-02-13 16:54:57 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-02-13 16:54:57 -0500 |
commit | b1876dec7ac6132b03b06277ef4d3bd8900b8805 (patch) | |
tree | 304d9bee28d443c741d7666f7e58f148a88df7d8 /src/SMAPI/Metadata | |
parent | fa3305e1d8cb079fcfbccd87d2368627b4138ee4 (diff) | |
download | SMAPI-b1876dec7ac6132b03b06277ef4d3bd8900b8805.tar.gz SMAPI-b1876dec7ac6132b03b06277ef4d3bd8900b8805.tar.bz2 SMAPI-b1876dec7ac6132b03b06277ef4d3bd8900b8805.zip |
fix asset propagation for map seats
Diffstat (limited to 'src/SMAPI/Metadata')
-rw-r--r-- | src/SMAPI/Metadata/CoreAssetPropagator.cs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index e2a28c62..5fb1b10d 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -452,8 +452,7 @@ namespace StardewModdingAPI.Metadata return true; case "tilesheets\\chairtiles": // Game1.LoadContent - MapSeat.mapChairTexture = content.Load<Texture2D>(key); - return true; + return this.ReloadChairTiles(content, key); case "tilesheets\\craftables": // Game1.LoadContent Game1.bigCraftableSpriteSheet = content.Load<Texture2D>(key); @@ -691,6 +690,28 @@ namespace StardewModdingAPI.Metadata return false; } + /// <summary>Reload map seat textures.</summary> + /// <param name="content">The content manager through which to reload the asset.</param> + /// <param name="key">The asset key to reload.</param> + /// <returns>Returns whether any textures were reloaded.</returns> + private bool ReloadChairTiles(LocalizedContentManager content, string key) + { + MapSeat.mapChairTexture = content.Load<Texture2D>(key); + + foreach (var location in this.GetLocations()) + { + foreach (MapSeat seat in location.mapSeats.Where(p => p != null)) + { + string curKey = this.NormalizeAssetNameIgnoringEmpty(seat._loadedTextureFile); + + if (curKey == null || key.Equals(curKey, StringComparison.OrdinalIgnoreCase)) + seat.overlayTexture = MapSeat.mapChairTexture; + } + } + + return true; + } + /// <summary>Reload critter textures.</summary> /// <param name="content">The content manager through which to reload the asset.</param> /// <param name="key">The asset key to reload.</param> |