Dedicated server can give clients the permission to use commands that only exist in the client project (los, lights, control, etc). Closes #476

This commit is contained in:
Joonas Rikkonen
2018-07-16 11:43:50 +03:00
parent 734b86bfba
commit ac5bad3011
3 changed files with 14 additions and 2 deletions
@@ -394,7 +394,7 @@ namespace Barotrauma
NewMessage(GUI.DisableHUD ? "Disabled HUD" : "Enabled HUD", Color.White);
}));
commands.Add(new Command("followsub", "followsub: Toggle whether the ", (string[] args) =>
commands.Add(new Command("followsub", "followsub: Toggle whether the camera should follow the nearest submarine.", (string[] args) =>
{
Camera.FollowSub = !Camera.FollowSub;
NewMessage(Camera.FollowSub ? "Set the camera to follow the closest submarine" : "Disabled submarine following.", Color.White);
@@ -14,7 +14,7 @@ namespace Barotrauma
{
lock (QueuedCommands)
{
while (QueuedCommands.Count>0)
while (QueuedCommands.Count > 0)
{
ExecuteCommand(QueuedCommands[0]);
QueuedCommands.RemoveAt(0);
@@ -190,6 +190,16 @@ namespace Barotrauma
NewMessage(ent.ToString(), Color.Lime);
}
}));
//"dummy commands" that only exist so that the server can give clients permissions to use them
commands.Add(new Command("control|controlcharacter", "control [character name]: Start controlling the specified character (client-only).", null));
commands.Add(new Command("los", "Toggle the line of sight effect on/off (client-only).", null));
commands.Add(new Command("lighting|lights", "Toggle lighting on/off (client-only).", null));
commands.Add(new Command("debugdraw", "Toggle the debug drawing mode on/off (client-only).", null));
commands.Add(new Command("togglehud|hud", "Toggle the character HUD (inventories, icons, buttons, etc) on/off (client-only).", null));
commands.Add(new Command("followsub", "Toggle whether the camera should follow the nearest submarine (client-only).", null));
commands.Add(new Command("toggleaitargets|aitargets", "Toggle the visibility of AI targets (= targets that enemies can detect and attack/escape from) (client-only).", null));
#if DEBUG
commands.Add(new Command("eventdata", "", (string[] args) =>
{
@@ -88,6 +88,7 @@ namespace Barotrauma
public void Execute(string[] args)
{
if (onExecute == null) return;
onExecute(args);
}
@@ -100,6 +101,7 @@ namespace Barotrauma
{
if (onClientRequestExecute == null)
{
if (onExecute == null) return;
onExecute(args);
}
else