mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-01 05:49:23 +00:00
52 lines
No EOL
1.3 KiB
C#
52 lines
No EOL
1.3 KiB
C#
using MelonLoader;
|
|
using NAK.AvatarScaleMod.InputHandling;
|
|
using NAK.AvatarScaleMod.Networking;
|
|
|
|
namespace NAK.AvatarScaleMod;
|
|
|
|
public class AvatarScaleMod : MelonMod
|
|
{
|
|
internal static MelonLogger.Instance Logger;
|
|
|
|
public override void OnInitializeMelon()
|
|
{
|
|
Logger = LoggerInstance;
|
|
|
|
ModNetwork.Subscribe();
|
|
ModSettings.Initialize();
|
|
|
|
ApplyPatches(typeof(HarmonyPatches.PlayerSetupPatches));
|
|
ApplyPatches(typeof(HarmonyPatches.PuppetMasterPatches));
|
|
ApplyPatches(typeof(HarmonyPatches.GesturePlaneTestPatches));
|
|
|
|
InitializeIntegration("BTKUILib", Integrations.BtkUiAddon.Initialize);
|
|
}
|
|
|
|
public override void OnUpdate()
|
|
{
|
|
ModNetwork.Update();
|
|
DebugKeybinds.DoDebugInput();
|
|
}
|
|
|
|
private static void InitializeIntegration(string modName, Action integrationAction)
|
|
{
|
|
if (RegisteredMelons.All(it => it.Info.Name != modName))
|
|
return;
|
|
|
|
Logger.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);
|
|
}
|
|
}
|
|
} |