fix asset propagation for Gil's portraits

This commit is contained in:
Jesse Plamondon-Willard 2020-05-04 17:41:45 -04:00
parent df6e745c6b
commit 4eb68e96ed
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
2 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,10 @@
← [README](README.md)
# Release notes
## Upcoming released
* For modders:
* Fixed asset propagation for Gil's portraits.
## 3.5
Released 27 April 2020 for Stardew Valley 1.4.1 or later.

View File

@ -816,9 +816,18 @@ namespace StardewModdingAPI.Metadata
where key != null && lookup.Contains(key)
select new { Npc = npc, Key = key }
)
.ToArray();
if (!characters.Any())
return;
.ToList();
// special case: Gil is a private NPC field on the AdventureGuild class (only used for the portrait)
{
string gilKey = this.NormalizeAssetNameIgnoringEmpty("Portraits/Gil");
if (lookup.Contains(gilKey))
{
GameLocation adventureGuild = Game1.getLocationFromName("AdventureGuild");
if (adventureGuild != null)
characters.Add(new { Npc = this.Reflection.GetField<NPC>(adventureGuild, "Gil").GetValue(), Key = gilKey });
}
}
// update portrait
foreach (var target in characters)