diff options
author | Michał Dolaś <me@shockah.pl> | 2022-11-09 20:26:50 +0100 |
---|---|---|
committer | Michał Dolaś <me@shockah.pl> | 2022-11-09 20:26:50 +0100 |
commit | 9fd8c35b462bc19efb520da21cda66f83559a66e (patch) | |
tree | 2afea790f6ce94df2e01cad9f73058c90128b3b8 /src/SMAPI | |
parent | 42b4b6b6a4ae1bb59182857b383539b24b063215 (diff) | |
download | SMAPI-9fd8c35b462bc19efb520da21cda66f83559a66e.tar.gz SMAPI-9fd8c35b462bc19efb520da21cda66f83559a66e.tar.bz2 SMAPI-9fd8c35b462bc19efb520da21cda66f83559a66e.zip |
Actually taking order into consideration
Diffstat (limited to 'src/SMAPI')
-rw-r--r-- | src/SMAPI/Framework/ModLoading/ModResolver.cs | 14 | ||||
-rw-r--r-- | src/SMAPI/Framework/SCore.cs | 4 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index f9ba73c4..8ef5e4a8 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -263,8 +263,18 @@ namespace StardewModdingAPI.Framework.ModLoading // sort mods IModMetadata[] allMods = mods.ToArray(); - IModMetadata[] modsToLoadEarly = allMods.Where(m => modIdsToLoadEarly.Contains(m.Manifest.UniqueID) && !modIdsToLoadLate.Contains(m.Manifest.UniqueID)).ToArray(); - IModMetadata[] modsToLoadLate = allMods.Where(m => modIdsToLoadLate.Contains(m.Manifest.UniqueID) && !modIdsToLoadEarly.Contains(m.Manifest.UniqueID)).ToArray(); + IModMetadata[] modsToLoadEarly = modIdsToLoadEarly + .Where(modId => !modIdsToLoadLate.Contains(modId)) + .Select(modId => allMods.FirstOrDefault(m => m.Manifest.UniqueID == modId)) + .Where(m => m != null) + .Select(m => m!) + .ToArray(); + IModMetadata[] modsToLoadLate = modIdsToLoadLate + .Where(modId => !modIdsToLoadEarly.Contains(modId)) + .Select(modId => allMods.FirstOrDefault(m => m.Manifest.UniqueID == modId)) + .Where(m => m != null) + .Select(m => m!) + .ToArray(); IModMetadata[] modsToLoadAsUsual = allMods.Where(m => !modsToLoadEarly.Contains(m) && !modsToLoadLate.Contains(m)).ToArray(); List<IModMetadata> orderSortedMods = new(); diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index 9e91924e..4d1eb959 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -426,10 +426,10 @@ namespace StardewModdingAPI.Framework // warn about mods that should load early or late which are not found at all, or both foreach (string modId in this.Settings.ModsToLoadEarly) if (!mods.Any(m => m.Manifest.UniqueID == modId)) - this.Monitor.Log($" SMAPI configuration specifies a mod {modId} that should load early, but it could not be found.", LogLevel.Warn); + this.Monitor.Log($" SMAPI configuration specifies a mod {modId} that should load early, but it could not be found or was skipped.", LogLevel.Warn); foreach (string modId in this.Settings.ModsToLoadLate) if (!mods.Any(m => m.Manifest.UniqueID == modId)) - this.Monitor.Log($" SMAPI configuration specifies a mod {modId} that should load late, but it could not be found.", LogLevel.Warn); + this.Monitor.Log($" SMAPI configuration specifies a mod {modId} that should load late, but it could not be found or was skipped.", LogLevel.Warn); foreach (string modId in this.Settings.ModsToLoadEarly) if (this.Settings.ModsToLoadLate.Contains(modId)) this.Monitor.Log($" SMAPI configuration specifies a mod {modId} that should load both early and late - this will be ignored.", LogLevel.Warn); |