From a11ff104a21f7982d128d872f9c3827bd0214c2d Mon Sep 17 00:00:00 2001 From: rob-v Date: Sun, 2 Apr 2017 12:03:55 +0200 Subject: [PATCH] Lost players except Host can not pause game #12227 --- OpenRA.Mods.Common/Commands/PlayerCommands.cs | 17 +++++++++-------- .../Widgets/WorldInteractionControllerWidget.cs | 3 ++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/OpenRA.Mods.Common/Commands/PlayerCommands.cs b/OpenRA.Mods.Common/Commands/PlayerCommands.cs index ceabcf5e5a..bb74577722 100644 --- a/OpenRA.Mods.Common/Commands/PlayerCommands.cs +++ b/OpenRA.Mods.Common/Commands/PlayerCommands.cs @@ -35,19 +35,20 @@ namespace OpenRA.Mods.Common.Commands public void InvokeCommand(string name, string arg) { - if (world.LocalPlayer == null) - return; - switch (name) { case "pause": - world.IssueOrder(new Order("PauseGame", null, false) - { - TargetString = world.Paused ? "UnPause" : "Pause" - }); + if (Game.IsHost || (world.LocalPlayer != null && world.LocalPlayer.WinState != WinState.Lost)) + world.IssueOrder(new Order("PauseGame", null, false) + { + TargetString = world.Paused ? "UnPause" : "Pause" + }); + break; case "surrender": - world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false)); + if (world.LocalPlayer != null) + world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false)); + break; } } diff --git a/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs index 7ded7477b9..1bc1f0e2f3 100644 --- a/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs @@ -241,7 +241,8 @@ namespace OpenRA.Mods.Common.Widgets { var key = Hotkey.FromKeyInput(e); - if (key == Game.Settings.Keys.PauseKey && World.LocalPlayer != null) // Disable pausing for spectators + if (key == Game.Settings.Keys.PauseKey + && (Game.IsHost || (World.LocalPlayer != null && World.LocalPlayer.WinState != WinState.Lost))) // Disable pausing for spectators and defeated players World.SetPauseState(!World.Paused); else if (key == Game.Settings.Keys.SelectAllUnitsKey && !World.IsGameOver) {