From 9331576751ca89ae140b19f283ba6bdbab8aab5b Mon Sep 17 00:00:00 2001 From: Tom Rijnbeek Date: Tue, 2 Jan 2024 20:46:50 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Ensure=20mod=20dependencies=20ar?= =?UTF-8?q?e=20always=20loaded?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Bearded.TD/Content/ContentManager.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Bearded.TD/Content/ContentManager.cs b/src/Bearded.TD/Content/ContentManager.cs index 6d604d922..2c8765743 100644 --- a/src/Bearded.TD/Content/ContentManager.cs +++ b/src/Bearded.TD/Content/ContentManager.cs @@ -159,9 +159,14 @@ public IModReference ReferenceMod(ModMetadata mod) private ModForLoading findModForLoading(ModMetadata metadata) { - if (modsForLoading.TryGetValue(metadata, out var mod)) + return modsForLoading.TryGetValue(metadata, out var mod) ? mod : queueModForLoading(metadata); + } + + private ModForLoading queueModForLoading(ModMetadata metadata) + { + foreach (var dep in metadata.Dependencies.Select(d => FindMetadata(d.Id))) { - return mod; + findModForLoading(dep); } var m = new ModForLoading(metadata);