fix asset propagation for map seats
This commit is contained in:
parent
fa3305e1d8
commit
b1876dec7a
|
@ -13,8 +13,9 @@
|
|||
* Fixed error running `install on Windows.bat` in very rare cases.
|
||||
|
||||
* For modders:
|
||||
* Fixed SMAPI toolkit defaulting the mod type incorrectly if a mod's `manifest.json` has neither `EntryDll` nor `ContentPackFor`. This only affects external tools, since SMAPI itself validates those fields separately.
|
||||
* Fixed asset propagation for `TileSheets/ChairTiles` not changing existing map seats.
|
||||
* Fixed edge case when playing in non-English where translatable assets loaded via `IAssetLoader` would no longer be applied after returning to the title screen unless manually invalidated from the cache.
|
||||
* Fixed SMAPI toolkit defaulting the mod type incorrectly if a mod's `manifest.json` has neither `EntryDll` nor `ContentPackFor`. This only affects external tools, since SMAPI itself validates those fields separately.
|
||||
|
||||
* For the ErrorHandler mod:
|
||||
* Added early detection of disposed textures so the crash stack trace shows the actual code which used them.
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue