[ChatBoxExtensions] Add AAS commands.

This commit is contained in:
NotAKidoS 2023-06-27 17:38:20 -05:00
parent b1fd591645
commit 8d4f17b8d1
4 changed files with 41 additions and 4 deletions

View file

@ -6,7 +6,7 @@ namespace NAK.ChatBoxExtensions.HarmonyPatches;
public class CVRInputManagerPatches public class CVRInputManagerPatches
{ {
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(CVRInputManager), "Start")] [HarmonyPatch(typeof(CVRInputManager), nameof(CVRInputManager.Start))]
static void Postfix_CVRInputManager_Start(ref CVRInputManager __instance) static void Postfix_CVRInputManager_Start(ref CVRInputManager __instance)
{ {
ChatBoxExtensions.InputModule = __instance.gameObject.AddComponent<InputModules.InputModuleChatBoxExtensions>(); ChatBoxExtensions.InputModule = __instance.gameObject.AddComponent<InputModules.InputModuleChatBoxExtensions>();

View file

@ -0,0 +1,32 @@
using ABI_RC.Core.Player;
namespace NAK.ChatBoxExtensions.Integrations;
internal class ChilloutVRAASCommands : CommandBase
{
public static void RegisterCommands()
{
// /aas [target player] [name] [value]
Commands.RegisterCommand("aas",
onCommandSent: (message, sound, displayMsg) =>
{
LocalCommandIgnoreOthers(message, args =>
{
if (args.Length > 2 && float.TryParse(args[2], out float value))
{
PlayerSetup.Instance.changeAnimatorParam(args[1], value);
}
});
},
onCommandReceived: (sender, message, sound, displayMsg) =>
{
RemoteCommandListenForAll(message, args =>
{
if (args.Length > 2 && float.TryParse(args[2], out float value))
{
PlayerSetup.Instance.changeAnimatorParam(args[1], value);
}
});
});
}
}

View file

@ -12,7 +12,7 @@ public class ChatBoxExtensions : MelonMod
{ {
Logger = LoggerInstance; Logger = LoggerInstance;
if (!MelonMod.RegisteredMelons.Any(it => it.Info.Name == "ChatBox")) if (RegisteredMelons.All(it => it.Info.Name != "ChatBox"))
{ {
Logger.Error("ChatBox was not found!"); Logger.Error("ChatBox was not found!");
return; return;
@ -23,12 +23,17 @@ public class ChatBoxExtensions : MelonMod
void ApplyIntegrations() void ApplyIntegrations()
{ {
Integrations.Commands.InitializeCommandHandlers(); Integrations.Commands.InitializeCommandHandlers();
Integrations.ChatBoxCommands.RegisterCommands(); Integrations.ChatBoxCommands.RegisterCommands();
Integrations.ChilloutVRBaseCommands.RegisterCommands(); Integrations.ChilloutVRBaseCommands.RegisterCommands();
Integrations.ChilloutVRAASCommands.RegisterCommands();
Integrations.ChilloutVRInputCommands.RegisterCommands();
ApplyPatches(typeof(HarmonyPatches.CVRInputManagerPatches)); ApplyPatches(typeof(HarmonyPatches.CVRInputManagerPatches));
if (MelonMod.RegisteredMelons.Any(it => it.Info.Name == "PlayerRagdollMod")) if (RegisteredMelons.Any(it => it.Info.Name == "PlayerRagdollMod"))
{ {
Integrations.PlayerRagdollModCommands.RegisterCommands(); Integrations.PlayerRagdollModCommands.RegisterCommands();
} }

View file

@ -28,6 +28,6 @@ using System.Reflection;
namespace ChatBoxExtensions.Properties; namespace ChatBoxExtensions.Properties;
internal static class AssemblyInfoParams internal static class AssemblyInfoParams
{ {
public const string Version = "1.0.1"; public const string Version = "1.0.2";
public const string Author = "NotAKidoS"; public const string Author = "NotAKidoS";
} }