diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-05-05 22:20:15 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-05-05 22:20:15 -0400 |
commit | 591b1aca780b4460c7845534eb624697025b891e (patch) | |
tree | d5a782061e89ae2068212f062b87f471b6c70138 /src | |
parent | efe94c26536ff4a346685da5d11252a9a9a5a0eb (diff) | |
download | SMAPI-591b1aca780b4460c7845534eb624697025b891e.tar.gz SMAPI-591b1aca780b4460c7845534eb624697025b891e.tar.bz2 SMAPI-591b1aca780b4460c7845534eb624697025b891e.zip |
update fence asset propagation in SDV 1.3
Diffstat (limited to 'src')
-rw-r--r-- | src/SMAPI/Metadata/CoreAssetPropagator.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index f057eebe..7ca0bd82 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -320,7 +320,7 @@ namespace StardewModdingAPI.Metadata return this.ReloadNpcSprites(content, key, monster: true); if (key.StartsWith(this.GetNormalisedPath("LooseSprites\\Fence"), StringComparison.InvariantCultureIgnoreCase)) - return this.ReloadFenceTextures(key); + return this.ReloadFenceTextures(content, key); if (this.IsInFolder(key, "Portraits")) return this.ReloadNpcPortraits(content, key); @@ -412,9 +412,10 @@ namespace StardewModdingAPI.Metadata } /// <summary>Reload the sprites for a fence type.</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 ReloadFenceTextures(string key) + private bool ReloadFenceTextures(LocalizedContentManager content, string key) { // get fence type if (!int.TryParse(this.GetSegments(key)[1].Substring("Fence".Length), out int fenceType)) @@ -425,16 +426,16 @@ namespace StardewModdingAPI.Metadata ( from location in this.GetLocations() from fence in location.Objects.Values.OfType<Fence>() - where fenceType == 1 - ? fence.isGate.Value - : fence.whichType.Value == fenceType + where + fence.whichType.Value == fenceType + || (fence.isGate.Value && fenceType == 1) // gates are hardcoded to draw fence type 1 select fence ) .ToArray(); // update fence textures foreach (Fence fence in fences) - fence.reloadSprite(); + this.Reflection.GetField<Lazy<Texture2D>>(fence, "fenceTexture").SetValue(new Lazy<Texture2D>(fence.loadFenceTexture)); return true; } |