This commit is contained in:
Evil Factory
2022-04-28 12:36:24 -03:00
91 changed files with 1140 additions and 491 deletions
@@ -164,18 +164,14 @@ namespace Barotrauma.Networking
}
public bool HasSpawned; //has the client spawned as a character during the current round
private List<Client> kickVoters;
private readonly List<Client> kickVoters;
public HashSet<Identifier> GivenAchievements = new HashSet<Identifier>();
public ClientPermissions Permissions = ClientPermissions.None;
public List<DebugConsole.Command> PermittedConsoleCommands
{
get;
private set;
}
public readonly HashSet<DebugConsole.Command> PermittedConsoleCommands = new HashSet<DebugConsole.Command>();
private object[] votes;
private readonly object[] votes;
public int KickVoteCount
{
@@ -195,7 +191,6 @@ namespace Barotrauma.Networking
this.Name = name;
this.ID = ID;
PermittedConsoleCommands = new List<DebugConsole.Command>();
kickVoters = new List<Client>();
votes = new object[Enum.GetNames(typeof(VoteType)).Length];
@@ -37,7 +37,7 @@ namespace Barotrauma.Networking
public readonly LocalizedString Name;
public readonly LocalizedString Description;
public readonly ClientPermissions Permissions;
public readonly List<DebugConsole.Command> PermittedCommands;
public readonly HashSet<DebugConsole.Command> PermittedCommands;
public PermissionPreset(XElement element)
{
@@ -51,7 +51,7 @@ namespace Barotrauma.Networking
DebugConsole.ThrowError("Error in permission preset \"" + Name + "\" - " + permissionsStr + " is not a valid permission!");
}
PermittedCommands = new List<DebugConsole.Command>();
PermittedCommands = new HashSet<DebugConsole.Command>();
if (Permissions.HasFlag(ClientPermissions.ConsoleCommands))
{
foreach (var subElement in element.Elements())
@@ -87,7 +87,7 @@ namespace Barotrauma.Networking
}
}
public bool MatchesPermissions(ClientPermissions permissions, List<DebugConsole.Command> permittedConsoleCommands)
public bool MatchesPermissions(ClientPermissions permissions, HashSet<DebugConsole.Command> permittedConsoleCommands)
{
return permissions == this.Permissions && PermittedCommands.SequenceEqual(permittedConsoleCommands);
}
@@ -443,6 +443,9 @@ namespace Barotrauma
{
removeQueue.Clear();
spawnQueue.Clear();
#if CLIENT
receivedEvents.Clear();
#endif
}
}
}
@@ -72,18 +72,18 @@ namespace Barotrauma.Networking
public readonly string EndPoint;
public readonly ulong SteamID;
public readonly string Name;
public List<DebugConsole.Command> PermittedCommands;
public HashSet<DebugConsole.Command> PermittedCommands;
public ClientPermissions Permissions;
public SavedClientPermission(string name, string endpoint, ClientPermissions permissions, List<DebugConsole.Command> permittedCommands)
public SavedClientPermission(string name, string endpoint, ClientPermissions permissions, HashSet<DebugConsole.Command> permittedCommands)
{
this.Name = name;
this.EndPoint = endpoint;
this.Permissions = permissions;
this.PermittedCommands = permittedCommands;
}
public SavedClientPermission(string name, ulong steamID, ClientPermissions permissions, List<DebugConsole.Command> permittedCommands)
public SavedClientPermission(string name, ulong steamID, ClientPermissions permissions, HashSet<DebugConsole.Command> permittedCommands)
{
this.Name = name;
this.SteamID = steamID;