summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-09-07 06:11:27 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-09-14 19:20:12 -0400
commitf5b46e8f3da3bb55ef1a116a8c24afa7fe2ec85b (patch)
tree968dd629dc9e56dab2b07432e7a84355140b05d7
parentdbd0b97c1790445e8ea187765a79ed22f9f0454b (diff)
downloadSMAPI-f5b46e8f3da3bb55ef1a116a8c24afa7fe2ec85b.tar.gz
SMAPI-f5b46e8f3da3bb55ef1a116a8c24afa7fe2ec85b.tar.bz2
SMAPI-f5b46e8f3da3bb55ef1a116a8c24afa7fe2ec85b.zip
add asset propagation for Data\FarmAnimals (#618)
-rw-r--r--docs/release-notes.md2
-rw-r--r--src/SMAPI/Metadata/CoreAssetPropagator.cs18
2 files changed, 19 insertions, 1 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index 4009d234..aab2edb3 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -52,7 +52,7 @@ These changes have not been released yet.
* Added support for content pack translations.
* Added fields and methods: `IContentPack.HasFile`, `Context.IsGameLaunched`, and `SemanticVersion.TryParse`.
* Added separate `LogNetworkTraffic` option to make verbose logging less overwhelmingly verbose.
- * Added asset propagation for critter textures and `DayTimeMoneyBox` buttons.
+ * Added asset propagation for `Data\FarmAnimals`, critter textures, and `DayTimeMoneyBox` buttons.
* `Constants.TargetPlatform` now returns `Android` when playing on an Android device.
* The installer now recognises custom game paths stored in `stardewvalley.targets`, if any.
* Trace logs for a broken mod now list all detected issues (instead of the first one).
diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs
index 5911ba2c..66e6ed14 100644
--- a/src/SMAPI/Metadata/CoreAssetPropagator.cs
+++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs
@@ -231,6 +231,9 @@ namespace StardewModdingAPI.Metadata
CraftingRecipe.craftingRecipes = content.Load<Dictionary<string, string>>(key);
return true;
+ case "data\\farmanimals": // FarmAnimal constructor
+ return this.ReloadFarmAnimalData();
+
case "data\\npcdispositions": // NPC constructor
return this.ReloadNpcDispositions(content, key);
@@ -599,6 +602,21 @@ namespace StardewModdingAPI.Metadata
return critters.Length;
}
+ /// <summary>Reload the data for matching farm animals.</summary>
+ /// <returns>Returns whether any farm animals were affected.</returns>
+ /// <remarks>Derived from the <see cref="FarmAnimal"/> constructor.</remarks>
+ private bool ReloadFarmAnimalData()
+ {
+ bool changed = false;
+ foreach (FarmAnimal animal in this.GetFarmAnimals())
+ {
+ animal.reloadData();
+ changed = true;
+ }
+
+ return changed;
+ }
+
/// <summary>Reload the sprites for a fence type.</summary>
/// <param name="key">The asset key to reload.</param>
/// <returns>Returns whether any textures were reloaded.</returns>