From 591b1aca780b4460c7845534eb624697025b891e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 5 May 2018 22:20:15 -0400 Subject: [PATCH] update fence asset propagation in SDV 1.3 --- src/SMAPI/Metadata/CoreAssetPropagator.cs | 13 +++++++------ 1 file 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 } /// Reload the sprites for a fence type. + /// The content manager through which to reload the asset. /// The asset key to reload. /// Returns whether any textures were reloaded. - 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() - 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>(fence, "fenceTexture").SetValue(new Lazy(fence.loadFenceTexture)); return true; }