(3db48532f) Give joining players "None" permissions by default (so server hosts can automatically give players some permissions if they want to). Save client permissions using the name of the permission preset instead of listing all the permissions given by the preset. Partially implements #1334

This commit is contained in:
Joonas Rikkonen
2019-04-01 14:25:33 +03:00
parent 6ffb28b6fb
commit 5cc2806185
4 changed files with 98 additions and 31 deletions
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
namespace Barotrauma.Networking
@@ -54,7 +55,9 @@ namespace Barotrauma.Networking
DebugConsole.Command command = DebugConsole.FindCommand(commandName);
if (command == null)
{
#if SERVER
DebugConsole.ThrowError("Error in permission preset \"" + Name + "\" - " + commandName + "\" is not a valid console command.");
#endif
continue;
}
@@ -75,5 +78,10 @@ namespace Barotrauma.Networking
List.Add(new PermissionPreset(element));
}
}
public bool MatchesPermissions(ClientPermissions permissions, List<DebugConsole.Command> permittedConsoleCommands)
{
return permissions == this.Permissions && PermittedCommands.SequenceEqual(permittedConsoleCommands);
}
}
}