mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-01 13:59:22 +00:00
54 lines
1.4 KiB
C#
54 lines
1.4 KiB
C#
using MelonLoader;
|
|
using NAK.ChatBoxExtensions.InputModules;
|
|
|
|
namespace NAK.ChatBoxExtensions;
|
|
|
|
public class ChatBoxExtensions : MelonMod
|
|
{
|
|
internal static MelonLogger.Instance Logger;
|
|
internal static InputModuleChatBoxExtensions InputModule = new();
|
|
|
|
public override void OnInitializeMelon()
|
|
{
|
|
Logger = LoggerInstance;
|
|
|
|
if (RegisteredMelons.All(it => it.Info.Name != "ChatBox"))
|
|
{
|
|
Logger.Error("ChatBox was not found!");
|
|
return;
|
|
}
|
|
|
|
ApplyIntegrations();
|
|
}
|
|
|
|
private void ApplyIntegrations()
|
|
{
|
|
|
|
Integrations.Commands.InitializeCommandHandlers();
|
|
Integrations.ChatBoxCommands.RegisterCommands();
|
|
|
|
Integrations.ChilloutVRBaseCommands.RegisterCommands();
|
|
Integrations.ChilloutVRAASCommands.RegisterCommands();
|
|
Integrations.ChilloutVRInputCommands.RegisterCommands();
|
|
|
|
ApplyPatches(typeof(HarmonyPatches.CVRInputManagerPatches));
|
|
|
|
if (RegisteredMelons.Any(it => it.Info.Name == "PlayerRagdollMod"))
|
|
{
|
|
Integrations.PlayerRagdollModCommands.RegisterCommands();
|
|
}
|
|
}
|
|
|
|
private void ApplyPatches(Type type)
|
|
{
|
|
try
|
|
{
|
|
HarmonyInstance.PatchAll(type);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Logger.Msg($"Failed while patching {type.Name}!");
|
|
Logger.Error(e);
|
|
}
|
|
}
|
|
}
|