Skip to content

Commit 0dbe140

Browse files
authored
Merge pull request #7 from Carnagion/development
Merge v2.0.2 into stable
2 parents c8ce42c + 6f97917 commit 0dbe140

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

Modding/ModLoader.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public static Mod LoadMod(string modDirectoryPath, bool executeAssemblies = true
4040
{
4141
// Load mod
4242
Mod mod = new(Mod.Metadata.Load(modDirectoryPath));
43+
ModLoader.loadedMods.Add(mod.Meta.Id, mod);
4344

4445
// Cache XML data of loaded mods for repeat enumeration later
4546
XmlElement[] data = ModLoader.LoadedMods.Values
@@ -57,9 +58,6 @@ public static Mod LoadMod(string modDirectoryPath, bool executeAssemblies = true
5758
ModLoader.StartupMod(mod);
5859
}
5960

60-
// Register mod as fully loaded
61-
ModLoader.loadedMods.Add(mod.Meta.Id, mod);
62-
6361
return mod;
6462
}
6563

@@ -84,6 +82,7 @@ public static IEnumerable<Mod> LoadMods(IEnumerable<string> modDirectoryPaths, b
8482
// Load mod
8583
Mod mod = new(metadata);
8684
mods.Add(mod);
85+
ModLoader.loadedMods.Add(mod.Meta.Id, mod);
8786

8887
// Apply mod patches
8988
XmlElement? root = mod.Data?.DocumentElement;
@@ -93,16 +92,10 @@ public static IEnumerable<Mod> LoadMods(IEnumerable<string> modDirectoryPaths, b
9392
}
9493
mod.Patches.ForEach(patch => data.ForEach(patch.Apply));
9594
}
96-
foreach (Mod mod in mods)
95+
// Execute mod assemblies
96+
if (executeAssemblies)
9797
{
98-
// Execute mod assemblies
99-
if (executeAssemblies)
100-
{
101-
ModLoader.StartupMod(mod);
102-
}
103-
104-
// Register mod as fully loaded
105-
ModLoader.loadedMods.Add(mod.Meta.Id, mod);
98+
mods.ForEach(ModLoader.StartupMod);
10699
}
107100
return mods;
108101
}

Modot.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!-- Workaround as Godot does not know how to properly load NuGet packages -->
99
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1010
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
11-
<PackageVersion>2.0.1</PackageVersion>
11+
<PackageVersion>2.0.2</PackageVersion>
1212
<Title>Modot</Title>
1313
<Authors>Carnagion</Authors>
1414
<Description>A mod loader and API for applications made using Godot, with the ability to load C# assemblies, XML data, and resource packs at runtime.</Description>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ A more detailed explanation of all features along with instructions on usage is
2020
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):
2121
```xml
2222
<ItemGroup>
23-
<PackageReference Include="Modot" Version="2.0.1"/>
23+
<PackageReference Include="Modot" Version="2.0.2"/>
2424
</ItemGroup>
2525
```
2626

0 commit comments

Comments
 (0)