summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-09-01 20:58:21 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-09-01 20:58:21 -0400
commit1240cb21024c3b715a6dacb2bec170a588a08791 (patch)
tree271c007b8a4dd533064af38fa2c125c0566e17b9 /src/SMAPI/Framework/ModLoading
parent8bfab94213e86c4245961150bd3423ee85213c5d (diff)
downloadSMAPI-1240cb21024c3b715a6dacb2bec170a588a08791.tar.gz
SMAPI-1240cb21024c3b715a6dacb2bec170a588a08791.tar.bz2
SMAPI-1240cb21024c3b715a6dacb2bec170a588a08791.zip
fix translations not initialized for temporary content packs
Diffstat (limited to 'src/SMAPI/Framework/ModLoading')
-rw-r--r--src/SMAPI/Framework/ModLoading/ModMetadata.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs
index 0ace084f..9e6bc61f 100644
--- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs
+++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs
@@ -83,6 +83,9 @@ namespace StardewModdingAPI.Framework.ModLoading
/// <inheritdoc />
public bool IsContentPack => this.Manifest?.ContentPackFor != null;
+ /// <summary>The fake content packs created by this mod, if any.</summary>
+ public ISet<WeakReference<ContentPack>> FakeContentPacks { get; } = new HashSet<WeakReference<ContentPack>>();
+
/*********
** Public methods
@@ -244,6 +247,21 @@ namespace StardewModdingAPI.Framework.ModLoading
return Path.Combine(rootFolderName, this.RelativeDirectoryPath);
}
+ /// <summary>Get the currently live fake content packs created by this mod.</summary>
+ public IEnumerable<ContentPack> GetFakeContentPacks()
+ {
+ foreach (var reference in this.FakeContentPacks.ToArray())
+ {
+ if (!reference.TryGetTarget(out ContentPack pack))
+ {
+ this.FakeContentPacks.Remove(reference);
+ continue;
+ }
+
+ yield return pack;
+ }
+ }
+
/*********
** Private methods