summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-09-18 21:51:50 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-09-18 21:51:50 -0400
commit7f47271be42a8017d48b8378600f2f17ccd38cae (patch)
tree0fbd33db1bc9cf4868e3d26a4a2a97a2e762ddfc /src
parent09f83a28f5e02f516dbc3ec84ce3251c1ee4d790 (diff)
downloadSMAPI-7f47271be42a8017d48b8378600f2f17ccd38cae.tar.gz
SMAPI-7f47271be42a8017d48b8378600f2f17ccd38cae.tar.bz2
SMAPI-7f47271be42a8017d48b8378600f2f17ccd38cae.zip
fix content packs not loaded before the mods that read them
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI/Framework/SCore.cs26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index 6441e889..24a15fc6 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -697,16 +697,28 @@ namespace StardewModdingAPI.Framework
IDictionary<IModMetadata, Tuple<string, string>> skippedMods = new Dictionary<IModMetadata, Tuple<string, string>>();
using (AssemblyLoader modAssemblyLoader = new AssemblyLoader(Constants.Platform, this.Monitor))
{
+ // init
HashSet<string> suppressUpdateChecks = new HashSet<string>(this.Settings.SuppressUpdateChecks, StringComparer.InvariantCultureIgnoreCase);
InterfaceProxyFactory proxyFactory = new InterfaceProxyFactory();
- foreach (IModMetadata mod in mods)
+ void LogSkip(IModMetadata mod, string errorPhrase, string errorDetails)
{
- if (!this.TryLoadMod(mod, mods, modAssemblyLoader, proxyFactory, jsonHelper, contentCore, modDatabase, suppressUpdateChecks, out string errorPhrase, out string errorDetails))
- {
- skippedMods[mod] = Tuple.Create(errorPhrase, errorDetails);
- if (mod.Status != ModMetadataStatus.Failed)
- mod.SetStatus(ModMetadataStatus.Failed, errorPhrase);
- }
+ skippedMods[mod] = Tuple.Create(errorPhrase, errorDetails);
+ if (mod.Status != ModMetadataStatus.Failed)
+ mod.SetStatus(ModMetadataStatus.Failed, errorPhrase);
+ }
+
+ // load content packs first (so they're available to mods)
+ foreach (IModMetadata contentPack in mods.Where(p => p.IsContentPack))
+ {
+ if (!this.TryLoadMod(contentPack, mods, modAssemblyLoader, proxyFactory, jsonHelper, contentCore, modDatabase, suppressUpdateChecks, out string errorPhrase, out string errorDetails))
+ LogSkip(contentPack, errorPhrase, errorDetails);
+ }
+
+ // load SMAPI mods
+ foreach (IModMetadata contentPack in mods.Where(p => !p.IsContentPack))
+ {
+ if (!this.TryLoadMod(contentPack, mods, modAssemblyLoader, proxyFactory, jsonHelper, contentCore, modDatabase, suppressUpdateChecks, out string errorPhrase, out string errorDetails))
+ LogSkip(contentPack, errorPhrase, errorDetails);
}
}
IModMetadata[] loadedContentPacks = this.ModRegistry.GetAll(assemblyMods: false).ToArray();