diff --git a/Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs b/Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs index 9f19ef0f..1d5f172e 100644 --- a/Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs @@ -7,6 +7,7 @@ using SPTarkov.Server.Core.Models.Spt.Mod; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Utils; using SPTarkov.Server.Core.Utils.Cloners; +using System.Reflection; namespace SPTarkov.Server.Core.Services.Mod; diff --git a/SPTarkov.Server/Program.cs b/SPTarkov.Server/Program.cs index 8bead8f3..4b1bc28d 100644 --- a/SPTarkov.Server/Program.cs +++ b/SPTarkov.Server/Program.cs @@ -3,6 +3,7 @@ using System.Runtime.InteropServices; using SPTarkov.Common.Semver; using SPTarkov.Common.Semver.Implementations; using SPTarkov.DI; +using SPTarkov.Server.Core.Loaders; using SPTarkov.Server.Core.Models.Spt.Mod; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; @@ -36,6 +37,9 @@ public static class Program // validate and sort mods, this will also discard any mods that are invalid var sortedLoadedMods = ValidateMods(loadedMods); + // update the loadedMods list with our validated sorted mods + loadedMods = sortedLoadedMods; + diHandler.AddInjectableTypesFromAssemblies(sortedLoadedMods.SelectMany(a => a.Assemblies)); } diHandler.InjectAll(); @@ -44,7 +48,24 @@ public static class Program builder.Services.AddSingleton>(loadedMods); var serviceProvider = builder.Services.BuildServiceProvider(); var logger = serviceProvider.GetService().CreateLogger("Server"); + // Load bundles for bundle mods + if (ProgramStatics.MODS()) + { + var bundleLoader = serviceProvider.GetService(); + foreach (var mod in loadedMods) + { + if (mod.ModMetadata?.IsBundleMod == true) + { + // Convert to relative path + string relativeModPath = Path.GetRelativePath( + Directory.GetCurrentDirectory(), + mod.Directory + ).Replace('\\', '/'); + bundleLoader.AddBundles(relativeModPath); + } + } + } try { SetConsoleOutputMode();