diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-12 01:31:52 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-08-12 01:31:52 -0400 |
commit | f7111a2488bd16b30c28be1025e7dbf9c4ca1306 (patch) | |
tree | 1ba6c04357a87e164a6689b83c1d96bb87b05785 /src/SMAPI | |
parent | 13f9a4d8d2155463f9ceaa41dd15d4526927476e (diff) | |
download | SMAPI-f7111a2488bd16b30c28be1025e7dbf9c4ca1306.tar.gz SMAPI-f7111a2488bd16b30c28be1025e7dbf9c4ca1306.tar.bz2 SMAPI-f7111a2488bd16b30c28be1025e7dbf9c4ca1306.zip |
add asset propagation for map tilesheets (#570)
Diffstat (limited to 'src/SMAPI')
-rw-r--r-- | src/SMAPI/Metadata/CoreAssetPropagator.cs | 18 |
1 files changed, 18 insertions, 0 deletions
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 { |