Dummy commands instead of dropping unknown cmds

AddCommand now replaces commands for connected players and saved perms
This commit is contained in:
Qowyn
2022-03-08 18:00:30 +01:00
parent 245619ab72
commit 2237aaafb3
2 changed files with 16 additions and 2 deletions
@@ -507,6 +507,21 @@ namespace Barotrauma
luaAddedCommand.Add(cmd);
DebugConsole.Commands.Add(cmd);
#if SERVER
foreach (var client in GameMain.Server.ConnectedClients) {
var index = client.PermittedConsoleCommands.FindIndex((pc) => pc.names[0] == cmd.names[0]);
if (index > -1) {
client.PermittedConsoleCommands[index] = cmd;
}
}
foreach (var permissions in GameMain.Server.ServerSettings.ClientPermissions) {
var index = permissions.PermittedCommands.FindIndex((pc) => pc.names[0] == cmd.names[0]);
if (index > -1) {
permissions.PermittedCommands[index] = cmd;
}
}
#endif
}
public List<DebugConsole.Command> Commands => DebugConsole.Commands;