Skip to content

Commit

Permalink
Merge pull request #7 from Carnagion/development
Browse files Browse the repository at this point in the history
Merge v2.0.2 into stable
  • Loading branch information
Carnagion committed Aug 17, 2022
2 parents c8ce42c + 6f97917 commit 0dbe140
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
17 changes: 5 additions & 12 deletions Modding/ModLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

Expand All @@ -84,6 +82,7 @@ public static IEnumerable<Mod> LoadMods(IEnumerable<string> 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;
Expand All @@ -93,16 +92,10 @@ public static IEnumerable<Mod> LoadMods(IEnumerable<string> 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;
}
Expand Down
2 changes: 1 addition & 1 deletion Modot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!-- Workaround as Godot does not know how to properly load NuGet packages -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>2.0.1</PackageVersion>
<PackageVersion>2.0.2</PackageVersion>
<Title>Modot</Title>
<Authors>Carnagion</Authors>
<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>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<ItemGroup>
<PackageReference Include="Modot" Version="2.0.1"/>
<PackageReference Include="Modot" Version="2.0.2"/>
</ItemGroup>
```

Expand Down

0 comments on commit 0dbe140

Please sign in to comment.