From 887e5af53840239024b820445bb7b4543d5f72e9 Mon Sep 17 00:00:00 2001 From: Carnagion Date: Wed, 17 Aug 2022 07:51:05 +0200 Subject: [PATCH 1/3] Add mod to loaded mods before executing patches or assemblies --- Modding/ModLoader.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Modding/ModLoader.cs b/Modding/ModLoader.cs index 9ffe957..6bac94d 100644 --- a/Modding/ModLoader.cs +++ b/Modding/ModLoader.cs @@ -84,6 +84,7 @@ public static IEnumerable LoadMods(IEnumerable modDirectoryPaths, b // Load mod Mod mod = new(metadata); mods.Add(mod); + ModLoader.loadedMods.Add(mod.Meta.Id, mod); // Apply mod patches XmlElement? root = mod.Data?.DocumentElement; @@ -93,16 +94,10 @@ public static IEnumerable LoadMods(IEnumerable modDirectoryPaths, b } mod.Patches.ForEach(patch => data.ForEach(patch.Apply)); } - foreach (Mod mod in mods) + // Execute mod assemblies + if (executeAssemblies) { - // Execute mod assemblies - if (executeAssemblies) - { - ModLoader.StartupMod(mod); - } - - // Register mod as fully loaded - ModLoader.loadedMods.Add(mod.Meta.Id, mod); + mods.ForEach(ModLoader.StartupMod); } return mods; } From 99b8e48a815c76d35a9e2075b937eade09db5a82 Mon Sep 17 00:00:00 2001 From: Carnagion Date: Wed, 17 Aug 2022 07:51:25 +0200 Subject: [PATCH 2/3] Update package version --- Modot.csproj | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modot.csproj b/Modot.csproj index ead8a9b..0125df0 100644 --- a/Modot.csproj +++ b/Modot.csproj @@ -8,7 +8,7 @@ true true - 2.0.1 + 2.0.2 Modot Carnagion A mod loader and API for applications made using Godot, with the ability to load C# assemblies, XML data, and resource packs at runtime. diff --git a/README.md b/README.md index 4eef7fa..73e2e7a 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ A more detailed explanation of all features along with instructions on usage is Simply include the following lines in a Godot project's `.csproj` file (either by editing the file manually or letting an IDE install the package): ```xml - + ``` From 6f9791725c1c8a0d39dee197e6676950f68fc41f Mon Sep 17 00:00:00 2001 From: Carnagion Date: Wed, 17 Aug 2022 07:53:18 +0200 Subject: [PATCH 3/3] Add mod to loaded mods before executing patches or assemblies --- Modding/ModLoader.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Modding/ModLoader.cs b/Modding/ModLoader.cs index 6bac94d..9396a5d 100644 --- a/Modding/ModLoader.cs +++ b/Modding/ModLoader.cs @@ -40,6 +40,7 @@ public static Mod LoadMod(string modDirectoryPath, bool executeAssemblies = true { // Load mod Mod mod = new(Mod.Metadata.Load(modDirectoryPath)); + ModLoader.loadedMods.Add(mod.Meta.Id, mod); // Cache XML data of loaded mods for repeat enumeration later XmlElement[] data = ModLoader.LoadedMods.Values @@ -57,9 +58,6 @@ public static Mod LoadMod(string modDirectoryPath, bool executeAssemblies = true ModLoader.StartupMod(mod); } - // Register mod as fully loaded - ModLoader.loadedMods.Add(mod.Meta.Id, mod); - return mod; }