mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
[IKAdjustments] Push latest changes
This commit is contained in:
parent
609afc37fc
commit
fee053bb64
6 changed files with 374 additions and 1 deletions
39
IKAdjustments/Main.cs
Normal file
39
IKAdjustments/Main.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using MelonLoader;
|
||||
using NAK.IKAdjustments.HarmonyPatches;
|
||||
using NAK.IKAdjustments.Integrations;
|
||||
|
||||
namespace NAK.IKAdjustments;
|
||||
|
||||
public class IKAdjustments : MelonMod
|
||||
{
|
||||
internal static string SettingsCategory = nameof(IKAdjustments);
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
ApplyPatches(typeof(IKSystemPatches));
|
||||
|
||||
InitializeIntegration("BTKUILib", BTKUIAddon.Initialize);
|
||||
}
|
||||
|
||||
private void InitializeIntegration(string modName, Action integrationAction)
|
||||
{
|
||||
if (RegisteredMelons.All(it => it.Info.Name != modName))
|
||||
return;
|
||||
|
||||
LoggerInstance.Msg($"Initializing {modName} integration.");
|
||||
integrationAction.Invoke();
|
||||
}
|
||||
|
||||
private void ApplyPatches(Type type)
|
||||
{
|
||||
try
|
||||
{
|
||||
HarmonyInstance.PatchAll(type);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LoggerInstance.Msg($"Failed while patching {type.Name}!");
|
||||
LoggerInstance.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue