Skip to content

Commit

Permalink
0.3.0
Browse files Browse the repository at this point in the history
- Allows mods to set a `Preload` method in their `mod_meta` file which will run immediately when the mod assembly is loaded, before the game itself loads.
  • Loading branch information
xen-42 authored Dec 5, 2023
2 parents f348f76 + 3423789 commit 4bfdf8b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Winch/Core/ModAssembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ private void ProcessPreload()
string preloadTypeName = preloadSetting.Split('/')[0];
string preloadMethodName = preloadSetting.Split('/')[1];

Type entrypointType = LoadedAssembly?.GetType(preloadTypeName) ??
Type preloaderType = LoadedAssembly?.GetType(preloadTypeName) ??
throw new EntryPointNotFoundException($"Could not find type {preloadTypeName} in Mod Assembly");
MethodInfo preloader = entrypointType.GetMethod(preloadMethodName) ??
MethodInfo preloader = preloaderType.GetMethod(preloadMethodName) ??
throw new EntryPointNotFoundException($"Could not find method {preloadTypeName} in type {preloadTypeName} in Mod Assembly");

WinchCore.Log.Debug($"Invoking preloader {entrypointType}.{preloadMethodName}...");
WinchCore.Log.Debug($"Invoking preloader {preloaderType}.{preloadMethodName}...");
preloader.Invoke(null, new object[0]);
}
}
Expand Down

0 comments on commit 4bfdf8b

Please sign in to comment.