Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions WorldBoxMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using NeoModLoader.services;
using NeoModLoader.ui;
using NeoModLoader.utils;
using NeoModLoader.utils.Builders;
using UnityEngine;

namespace NeoModLoader;
Expand Down Expand Up @@ -80,7 +79,6 @@
Harmony.CreateAndPatchAll(typeof(LM), Others.harmony_id);
Harmony.CreateAndPatchAll(typeof(ResourcesPatch), Others.harmony_id);
Harmony.CreateAndPatchAll(typeof(CustomAudioManager), Others.harmony_id);
Harmony.CreateAndPatchAll(typeof(AssetPatches), Others.harmony_id);
if (!SmoothLoader.isLoading()) SmoothLoader.prepare();

SmoothLoader.add(() =>
Expand Down Expand Up @@ -124,19 +122,17 @@
}
}, "Compile Mod " + mod.mod_decl.Name);
}
MasterBuilder Builder = new();
AssetLinker Linker = new();
foreach (var mod in mod_nodes)
{
SmoothLoader.add(() =>
{
if (mods_to_load.Contains(mod.mod_decl))
{
ResourcesPatch.LoadResourceFromFolder(Path.Combine(mod.mod_decl.FolderPath,
Paths.ModResourceFolderName), out List<Builder> builders);
Builder.AddBuilders(builders);
Paths.ModResourceFolderName), Linker);
ResourcesPatch.LoadResourceFromFolder(Path.Combine(mod.mod_decl.FolderPath,
Paths.NCMSAdditionModResourceFolderName), out List<Builder> builders2);
Builder.AddBuilders(builders2);
Paths.NCMSAdditionModResourceFolderName), Linker);
ResourcesPatch.LoadAssetBundlesFromFolder(Path.Combine(mod.mod_decl.FolderPath,
Paths.ModAssetBundleFolderName));
}
Expand All @@ -146,7 +142,7 @@
SmoothLoader.add(() =>
{
ModCompileLoadService.loadMods(mods_to_load);
Builder.BuildAll();
Linker.AddAssets();
ModInfoUtils.SaveModRecords();
NCMSCompatibleLayer.Init();
var successfulInit = new Dictionary<IMod, bool>();
Expand Down Expand Up @@ -331,7 +327,7 @@
LogService.LogInfo($"NeoModLoader.dll is newer than AutoUpdate.dll, " +
$"re-extract AutoUpdate.dll from NeoModLoader.dll");
}
catch (Exception e)

Check warning on line 330 in WorldBoxMod.cs

View workflow job for this annotation

GitHub Actions / Windows

The variable 'e' is declared but never used
{
// ignored
}
Expand Down
11 changes: 4 additions & 7 deletions services/ModCompileLoadService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using NeoModLoader.General;
using NeoModLoader.ncms_compatible_layer;
using NeoModLoader.utils;
using NeoModLoader.utils.Builders;
using UnityEngine;

namespace NeoModLoader.services;
Expand Down Expand Up @@ -400,7 +399,7 @@
GameObject mod_instance;
foreach (var type in mod_assembly.GetTypes())
{
var mod_entry = Attribute.GetCustomAttribute(type, typeof(ModEntry));

Check warning on line 402 in services/ModCompileLoadService.cs

View workflow job for this annotation

GitHub Actions / Windows

'ModEntry' is obsolete: 'Compatible Layer will not be maintained and be removed in the future'
if (!type.IsSubclassOf(typeof(MonoBehaviour)) ||
(type.GetInterface(nameof(IMod)) == null && mod_entry == null) || type.IsAbstract) continue;

Expand All @@ -419,7 +418,7 @@
pMod.IsNCMSMod = true;
Type ncmsGlobalObjectType = mod_assembly.GetType("Mod");
ncmsGlobalObjectType.GetField("Info")
?.SetValue(null, new Info(NCMSCompatibleLayer.GenerateNCMSMod(pMod)));

Check warning on line 421 in services/ModCompileLoadService.cs

View workflow job for this annotation

GitHub Actions / Windows

'Info' is obsolete: 'Compatible Layer will not be maintained and be removed in the future'
ncmsGlobalObjectType.GetField("GameObject")?.SetValue(null, mod_instance);
}

Expand Down Expand Up @@ -628,15 +627,13 @@
bool compile_success = TryCompileModAtRuntime(mod_declare);

if (!compile_success) return false;
MasterBuilder Builder = new MasterBuilder();
ResourcesPatch.LoadResourceFromFolder(Path.Combine(mod_declare.FolderPath, Paths.ModResourceFolderName), out List<Builder> builders);
AssetLinker Linker = new AssetLinker();
ResourcesPatch.LoadResourceFromFolder(Path.Combine(mod_declare.FolderPath, Paths.ModResourceFolderName), Linker);
ResourcesPatch.LoadResourceFromFolder(Path.Combine(mod_declare.FolderPath,
Paths.NCMSAdditionModResourceFolderName), out List<Builder> builders2);
Paths.NCMSAdditionModResourceFolderName), Linker);

LoadMod(mod_declare);
Builder.AddBuilders(builders);
Builder.AddBuilders(builders2);
Builder.BuildAll();
Linker.AddAssets();
return true;
}

Expand Down
11 changes: 4 additions & 7 deletions services/ModReloadService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using NeoModLoader.constants;
using NeoModLoader.General;
using NeoModLoader.utils;
using NeoModLoader.utils.Builders;

namespace NeoModLoader.services;

Expand All @@ -18,14 +17,12 @@ public static bool HotfixMethods(IReloadable pMod, ModDeclare pModDeclare)

public static bool ReloadResources(IMod pMod)
{
MasterBuilder Builder = new();
AssetLinker Linker = new();
ResourcesPatch.LoadResourceFromFolder(Path.Combine(pMod.GetDeclaration().FolderPath,
Paths.ModResourceFolderName), out List<Builder> builders);
Paths.ModResourceFolderName), Linker);
ResourcesPatch.LoadResourceFromFolder(Path.Combine(pMod.GetDeclaration().FolderPath,
Paths.NCMSAdditionModResourceFolderName), out List<Builder> builders2);
Builder.AddBuilders(builders);
Builder.AddBuilders(builders2);
Builder.BuildAll();
Paths.NCMSAdditionModResourceFolderName), Linker);
Linker.AddAssets();
return false;
}

Expand Down
Loading
Loading