v1.0.13.1 (first post-1.0 patch)
This commit is contained in:
@@ -13,6 +13,15 @@ namespace Barotrauma
|
||||
{
|
||||
static partial class DebugConsole
|
||||
{
|
||||
private static readonly RateLimiter rateLimiter = new(
|
||||
maxRequests: 50,
|
||||
expiryInSeconds: 5,
|
||||
punishmentRules: new[]
|
||||
{
|
||||
(RateLimitAction.OnLimitReached, RateLimitPunishment.Announce),
|
||||
(RateLimitAction.OnLimitDoubled, RateLimitPunishment.Kick)
|
||||
});
|
||||
|
||||
public partial class Command
|
||||
{
|
||||
/// <summary>
|
||||
@@ -608,12 +617,12 @@ namespace Barotrauma
|
||||
NewMessage("Valid ranks are:", Color.White);
|
||||
foreach (PermissionPreset permissionPreset in PermissionPreset.List)
|
||||
{
|
||||
NewMessage(" - " + permissionPreset.Name, Color.White);
|
||||
NewMessage(" - " + permissionPreset.DisplayName, Color.White);
|
||||
}
|
||||
|
||||
ShowQuestionPrompt("Rank to grant to \"" + client.Name + "\"?", (rank) =>
|
||||
{
|
||||
PermissionPreset preset = PermissionPreset.List.Find(p => p.Name.Equals(rank, StringComparison.OrdinalIgnoreCase));
|
||||
PermissionPreset preset = PermissionPreset.List.Find(p => p.DisplayName.Equals(rank, StringComparison.OrdinalIgnoreCase));
|
||||
if (preset == null)
|
||||
{
|
||||
ThrowError("Rank \"" + rank + "\" not found.");
|
||||
@@ -622,7 +631,7 @@ namespace Barotrauma
|
||||
|
||||
client.SetPermissions(preset.Permissions, preset.PermittedCommands);
|
||||
GameMain.Server.UpdateClientPermissions(client);
|
||||
NewMessage("Assigned the rank \"" + preset.Name + "\" to " + client.Name + ".", Color.White);
|
||||
NewMessage("Assigned the rank \"" + preset.DisplayName + "\" to " + client.Name + ".", Color.White);
|
||||
}, args, 1);
|
||||
});
|
||||
|
||||
@@ -1992,6 +2001,7 @@ namespace Barotrauma
|
||||
"freecam",
|
||||
(Client client, Vector2 cursorWorldPos, string[] args) =>
|
||||
{
|
||||
client.UsingFreeCam = true;
|
||||
GameMain.Server.SetClientCharacter(client, null);
|
||||
client.SpectateOnly = true;
|
||||
}
|
||||
@@ -2105,7 +2115,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
string rank = string.Join("", args.Skip(1));
|
||||
PermissionPreset preset = PermissionPreset.List.Find(p => p.Name.Equals(rank, StringComparison.OrdinalIgnoreCase));
|
||||
PermissionPreset preset = PermissionPreset.List.Find(p => p.DisplayName.Equals(rank, StringComparison.OrdinalIgnoreCase));
|
||||
if (preset == null)
|
||||
{
|
||||
GameMain.Server.SendConsoleMessage("Rank \"" + rank + "\" not found.", senderClient, Color.Red);
|
||||
@@ -2114,8 +2124,8 @@ namespace Barotrauma
|
||||
|
||||
client.SetPermissions(preset.Permissions, preset.PermittedCommands);
|
||||
GameMain.Server.UpdateClientPermissions(client);
|
||||
GameMain.Server.SendConsoleMessage($"Assigned the rank \"{preset.Name}\" to {client.Name}.", senderClient);
|
||||
NewMessage(senderClient.Name + " granted the rank \"" + preset.Name + "\" to " + client.Name + ".", Color.White);
|
||||
GameMain.Server.SendConsoleMessage($"Assigned the rank \"{preset.DisplayName}\" to {client.Name}.", senderClient);
|
||||
NewMessage(senderClient.Name + " granted the rank \"" + preset.DisplayName + "\" to " + client.Name + ".", Color.White);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -2509,26 +2519,37 @@ namespace Barotrauma
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
item.TryCreateServerEventSpam();
|
||||
item.CreateStatusEvent();
|
||||
item.CreateStatusEvent(loadingRound: false);
|
||||
}
|
||||
foreach (Structure wall in Structure.WallList)
|
||||
{
|
||||
GameMain.Server.CreateEntityEvent(wall);
|
||||
}
|
||||
}));
|
||||
commands.Add(new Command("stallfiletransfers", "stallfiletransfers [seconds]: A debug command that stalls each file transfer packet by the specified duration.", (string[] args) =>
|
||||
commands.Add(new Command("stallfiletransfers", "stallfiletransfers [seconds]: A debug command that makes all file transfers take at least the specified duration.", (string[] args) =>
|
||||
{
|
||||
float seconds = 0.0f;
|
||||
if (args.Length > 0)
|
||||
{
|
||||
float.TryParse(args[0], out seconds);
|
||||
}
|
||||
GameMain.Server.FileSender.StallPacketsTime = seconds;
|
||||
GameMain.Server.FileSender.ForceMinimumFileTransferDuration = seconds;
|
||||
NewMessage("Set file transfer stall time to " + seconds);
|
||||
}));
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void ServerRead(IReadMessage inc, Client sender)
|
||||
{
|
||||
string consoleCommand = inc.ReadString();
|
||||
float cursorX = inc.ReadSingle();
|
||||
float cursorY = inc.ReadSingle();
|
||||
|
||||
if (rateLimiter.IsLimitReached(sender)) { return; }
|
||||
|
||||
ExecuteClientCommand(sender, new Vector2(cursorX, cursorY), consoleCommand);
|
||||
}
|
||||
|
||||
public static void ExecuteClientCommand(Client client, Vector2 cursorWorldPos, string command)
|
||||
{
|
||||
if (GameMain.Server == null) return;
|
||||
|
||||
Reference in New Issue
Block a user