[NAK_CVR_MODS] some cleanup to repo

This commit is contained in:
NotAKidoS 2024-04-23 16:01:33 -05:00
parent 9944ad7611
commit 926cdcef66
16 changed files with 183964 additions and 1350 deletions

View file

@ -8,6 +8,9 @@
<!-- Didn't put in the Directory.Build.props because it spams funny warnings... -->
<ItemGroup>
<Reference Include="ECM2">
<HintPath>..\.ManagedLibs\ECM2.dll</HintPath>
</Reference>
<Reference Include="ml_prm">
<HintPath>$(MsBuildThisFileDirectory)\..\.ManagedLibs\ml_prm.dll</HintPath>
<Private>False</Private>

View file

@ -18,9 +18,9 @@ public class CommandBase
{
string partialName = argument.Replace("*", "").Trim();
if (String.IsNullOrWhiteSpace(partialName)) return false;
return AuthManager.username.Contains(partialName);
return AuthManager.Username.Contains(partialName);
}
return AuthManager.username == argument;
return AuthManager.Username == argument;
}
internal static void LocalCommandIgnoreOthers(string argument, Action<string[]> callback)

View file

@ -39,5 +39,53 @@ internal class ChatBoxCommands : CommandBase
API.SendMessage($"You have to ping first, {GetPlayerUsername(sender)}!", false, true, true);
});
});
Commands.RegisterCommand("sudo",
onCommandSent: (message, sound, displayMsg) =>
{
LocalCommandIgnoreOthers(message, args =>
{
if (args.Length > 1)
{
string command = string.Join(" ", args.Skip(1));
API.SendMessage($"/{command}", false, true, true);
}
});
},
onCommandReceived: (sender, message, sound, displayMsg) =>
{
RemoteCommandListenForAll(message, args =>
{
if (args.Length > 1)
{
string command = string.Join(" ", args.Skip(1));
API.SendMessage($"/{command}", false, true, true);
}
});
});
Commands.RegisterCommand("say",
onCommandSent: (message, sound, displayMsg) =>
{
LocalCommandIgnoreOthers(message, args =>
{
if (args.Length > 0)
{
string text = string.Join(" ", args);
API.SendMessage(text, false, true, true);
}
});
},
onCommandReceived: (sender, message, sound, displayMsg) =>
{
RemoteCommandListenForAll(message, args =>
{
if (args.Length > 0)
{
string text = string.Join(" ", args);
API.SendMessage(text, false, true, true);
}
});
});
}
}

View file

@ -1,5 +1,8 @@
using ABI_RC.Core;
using ABI_RC.Core.Vivox;
using ABI_RC.Core.Base;
using ABI_RC.Core.Player;
using ABI_RC.Systems.Movement;
using UnityEngine;
namespace NAK.ChatBoxExtensions.Integrations;
@ -28,14 +31,87 @@ internal class ChilloutVRBaseCommands : CommandBase
{
LocalCommandIgnoreOthers(message, args =>
{
VivoxDeviceHandler.InputMuted = true;
AudioManagement.SetMicrophoneActive(false);
});
},
onCommandReceived: (sender, message, sound, displayMsg) =>
{
RemoteCommandListenForAll(message, args =>
{
VivoxDeviceHandler.InputMuted = false;
AudioManagement.SetMicrophoneActive(false);
});
});
// teleport [x] [y] [z]
Commands.RegisterCommand("teleport",
onCommandSent: (message, sound, displayMsg) =>
{
LocalCommandIgnoreOthers(message, args =>
{
if (args.Length > 2 && float.TryParse(args[0], out float x) && float.TryParse(args[1], out float y) && float.TryParse(args[2], out float z))
{
BetterBetterCharacterController.Instance.TeleportPlayerTo(new Vector3(x, y, z), false, false);
}
});
},
onCommandReceived: (sender, message, sound, displayMsg) =>
{
RemoteCommandListenForAll(message, args =>
{
if (args.Length > 2 && float.TryParse(args[0], out float x) && float.TryParse(args[1], out float y) && float.TryParse(args[2], out float z))
{
BetterBetterCharacterController.Instance.TeleportPlayerTo(new Vector3(x, y, z), false, false);
}
});
});
// tp [x] [y] [z]
Commands.RegisterCommand("tp",
onCommandSent: (message, sound, displayMsg) =>
{
LocalCommandIgnoreOthers(message, args =>
{
if (args.Length > 2 && float.TryParse(args[0], out float x) && float.TryParse(args[1], out float y) && float.TryParse(args[2], out float z))
{
BetterBetterCharacterController.Instance.TeleportPlayerTo(new Vector3(x, y, z), false, false);
}
});
},
onCommandReceived: (sender, message, sound, displayMsg) =>
{
RemoteCommandListenForAll(message, args =>
{
if (args.Length > 2 && float.TryParse(args[0], out float x) && float.TryParse(args[1], out float y) && float.TryParse(args[2], out float z))
{
BetterBetterCharacterController.Instance.TeleportPlayerTo(new Vector3(x, y, z), false, false);
}
});
});
// teleport [player]
Commands.RegisterCommand("teleport",
onCommandSent: (message, sound, displayMsg) =>
{
LocalCommandIgnoreOthers(message, args =>
{
if (args.Length > 0)
{
string player = args[0];
CVRPlayerEntity playerEnt = CVRPlayerManager.Instance.NetworkPlayers.FirstOrDefault(x => x.Username == player);
if (playerEnt != null) BetterBetterCharacterController.Instance.TeleportPlayerTo(playerEnt.PuppetMaster.transform.position, false, false);
}
});
},
onCommandReceived: (sender, message, sound, displayMsg) =>
{
RemoteCommandListenForAll(message, args =>
{
if (args.Length > 0)
{
string player = args[0y];
CVRPlayerEntity playerEnt = CVRPlayerManager.Instance.NetworkPlayers.FirstOrDefault(x => x.Username == player);
if (playerEnt != null) BetterBetterCharacterController.Instance.TeleportPlayerTo(playerEnt.PuppetMaster.transform.position, false, false);
}
});
});
}

View file

@ -25,7 +25,6 @@ public static class Commands
private class Command
{
internal string Prefix;
// Command Sent (message)