diff options
-rw-r--r-- | docs/release-notes.md | 5 | ||||
-rw-r--r-- | src/SMAPI/Metadata/CoreAssetPropagator.cs | 18 |
2 files changed, 22 insertions, 1 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index 9ac52ab1..ab47b5c7 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -13,7 +13,10 @@ * For modders: * Added support for `.json` data files in the content API (including Content Patcher). - * Fixed changes through the content API not propagating correctly for dialogue and child sprites. + * Added automatic propagation when changing assets through the content API for... + * child sprites; + * dialogue; + * map tilesheets. * Added `--mods-path` command-line argument to allow switching between mod folders. * All enums are now JSON-serialised by name, since that's more user-friendly. Previously only certain predefined enums were serialised that way. JSON files which already have integer enums will still be parsed fine. * Fixed false compatibility error when constructing multidimensional arrays. diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index e9d66975..8487b6be 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -13,6 +13,7 @@ using StardewValley.Menus; using StardewValley.Objects; using StardewValley.Projectiles; using StardewValley.TerrainFeatures; +using xTile.Tiles; namespace StardewModdingAPI.Metadata { @@ -63,6 +64,23 @@ namespace StardewModdingAPI.Metadata /// <returns>Returns any non-null value to indicate an asset was loaded.</returns> private object PropagateImpl(LocalizedContentManager content, string key) { + /**** + ** Special case: current map tilesheet + ** We only need to do this for the current location, since tilesheets are reloaded when you enter a location. + ** Just in case, we should still propagate by key even if a tilesheet is matched. + ****/ + if (Game1.currentLocation?.map?.TileSheets != null) + { + foreach (TileSheet tilesheet in Game1.currentLocation.map.TileSheets) + { + if (this.GetNormalisedPath(tilesheet.ImageSource) == key) + Game1.mapDisplayDevice.LoadTileSheet(tilesheet); + } + } + + /**** + ** Propagate by key + ****/ Reflector reflection = this.Reflection; switch (key.ToLower().Replace("/", "\\")) // normalised key so we can compare statically { |