Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop

This commit is contained in:
EvilFactory
2024-04-12 12:11:06 -03:00
20 changed files with 204 additions and 25 deletions

View File

@@ -785,6 +785,7 @@ namespace Barotrauma
AssignRelayToServer("simulatedduplicateschance", false);
AssignRelayToServer("simulatedlongloadingtime", false);
AssignRelayToServer("storeinfo", false);
AssignRelayToServer("sendrawpacket", false);
#endif
commands.Add(new Command("clientlist", "", (string[] args) => { }));
@@ -3273,6 +3274,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) =>