This commit is contained in:
Regalis11
2024-04-12 16:37:51 +03:00
parent 332be4c9d2
commit 18af2754db
20 changed files with 204 additions and 25 deletions
@@ -775,6 +775,7 @@ namespace Barotrauma
AssignRelayToServer("simulatedduplicateschance", false);
AssignRelayToServer("simulatedlongloadingtime", false);
AssignRelayToServer("storeinfo", false);
AssignRelayToServer("sendrawpacket", false);
#endif
commands.Add(new Command("clientlist", "", (string[] args) => { }));
@@ -3263,6 +3264,36 @@ namespace Barotrauma
LocationType.Prefabs.Select(lt => lt.Identifier.Value).ToArray()
};
}));
commands.Add(new Command("sendrawpacket", "sendrawpacket [data]: Send a string of hex values as raw binary data to the server", (string[] args) =>
{
if (GameMain.NetworkMember is null)
{
ThrowError("Not connected to a server");
return;
}
if (args.Length == 0)
{
ThrowError("No data provided");
return;
}
string dataString = string.Join(" ", args);
try
{
byte[] bytes = ToolBox.HexStringToBytes(dataString);
IWriteMessage msg = new WriteOnlyMessage();
foreach (byte b in bytes) { msg.WriteByte(b); }
GameMain.Client?.ClientPeer?.DebugSendRawMessage(msg);
NewMessage($"Sent {bytes.Length} byte(s)", Color.Green);
}
catch (Exception e)
{
ThrowError("Failed to parse the data", e);
}
}));
#endif
commands.Add(new Command("limbscale", "Define the limbscale for the controlled character. Provide id or name if you want to target another character. Note: the changes are not saved!", (string[] args) =>