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