diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/MultiPlayerCampaign.cs b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/MultiPlayerCampaign.cs index 0ab86bef6..142d4c73c 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/MultiPlayerCampaign.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/GameModes/MultiPlayerCampaign.cs @@ -92,8 +92,7 @@ namespace Barotrauma if (endWatchman != null) { InitializeWatchman(endWatchman); } } } - - + protected override void WatchmanInteract(Character watchman, Character interactor) { if ((watchman.Submarine == Level.Loaded.StartOutpost && !Submarine.MainSub.AtStartPosition) || @@ -107,8 +106,7 @@ namespace Barotrauma return; } - if (GameMain.Client != null && interactor == Character.Controlled && - (GameMain.Client.HasPermission(ClientPermissions.ManageRound) || GameMain.Client.HasPermission(ClientPermissions.ManageCampaign))) + if (GameMain.Client != null && interactor == Character.Controlled) { var msgBox = new GUIMessageBox("", TextManager.Get("CampaignEnterOutpostPrompt") .Replace("[locationname]", Submarine.MainSub.AtStartPosition ? Map.CurrentLocation.Name : Map.SelectedLocation.Name), @@ -122,8 +120,7 @@ namespace Barotrauma return true; }; msgBox.Buttons[0].OnClicked += msgBox.Close; - msgBox.Buttons[1].OnClicked += msgBox.Close; - + msgBox.Buttons[1].OnClicked += msgBox.Close; } } diff --git a/Barotrauma/BarotraumaServer/Source/GameSession/GameModes/MultiPlayerCampaign.cs b/Barotrauma/BarotraumaServer/Source/GameSession/GameModes/MultiPlayerCampaign.cs index 0656ea051..b94525388 100644 --- a/Barotrauma/BarotraumaServer/Source/GameSession/GameModes/MultiPlayerCampaign.cs +++ b/Barotrauma/BarotraumaServer/Source/GameSession/GameModes/MultiPlayerCampaign.cs @@ -72,6 +72,27 @@ namespace Barotrauma }); } + public bool AllowedToEndRound(Character interactor) + { + if (interactor == null || Level.Loaded?.StartOutpost == null || Level.Loaded?.EndOutpost == null) + { + return false; + } + + if (interactor.Submarine == Level.Loaded.StartOutpost && + interactor.CanInteractWith(startWatchman)) + { + return true; + } + if (interactor.Submarine == Level.Loaded.EndOutpost && + interactor.CanInteractWith(endWatchman)) + { + return true; + } + + return false; + } + protected override void WatchmanInteract(Character watchman, Character interactor) { if ((watchman.Submarine == Level.Loaded.StartOutpost && !Submarine.MainSub.AtStartPosition) || @@ -85,8 +106,7 @@ namespace Barotrauma if (GameMain.Server != null) { var client = GameMain.Server.ConnectedClients.Find(c => c.Character == interactor); - hasPermissions = client != null && - (client.HasPermission(ClientPermissions.ManageRound) || client.HasPermission(ClientPermissions.ManageCampaign)); + hasPermissions = client != null; CreateDialog(new List { watchman }, hasPermissions ? "WatchmanInteract" : "WatchmanInteractNotAllowed", 1.0f); } } diff --git a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs index 56bd4ee0a..09800ecfa 100644 --- a/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaServer/Source/Networking/GameServer.cs @@ -995,7 +995,17 @@ namespace Barotrauma.Networking return; } - if (!sender.HasPermission(command)) + //clients are allowed to end the round by talking with the watchman in multiplayer + //campaign even if they don't have the special permission + if (command == ClientPermissions.ManageRound && inc.PeekBoolean() && + GameMain.GameSession?.GameMode is MultiPlayerCampaign mpCampaign) + { + if (!mpCampaign.AllowedToEndRound(sender.Character)) + { + return; + } + } + else if (!sender.HasPermission(command)) { Log("Client \"" + sender.Name + "\" sent a server command \"" + command + "\". Permission denied.", ServerLog.MessageType.ServerMessage); return;