From dd9d5450bc23a9de2284f3a6b726a7c6735e362a Mon Sep 17 00:00:00 2001 From: rob-v Date: Wed, 9 Aug 2017 20:30:15 +0200 Subject: [PATCH] Add EnableDebugCommandsInReplays option --- OpenRA.Game/Settings.cs | 1 + OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs | 2 +- OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs | 1 + mods/cnc/chrome/settings.yaml | 7 +++++++ mods/common/chrome/settings.yaml | 7 +++++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Settings.cs b/OpenRA.Game/Settings.cs index 2693d0388e..fdc00f88aa 100644 --- a/OpenRA.Game/Settings.cs +++ b/OpenRA.Game/Settings.cs @@ -94,6 +94,7 @@ namespace OpenRA public bool SendSystemInformation = true; public int SystemInformationVersionPrompt = 0; public string UUID = System.Guid.NewGuid().ToString(); + public bool EnableDebugCommandsInReplays = false; } public class GraphicSettings diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs index ac618eafca..5269a44c6e 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs @@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic Game.BeforeGameStart += UnregisterEvents; CloseChat(); - chatText.IsDisabled = () => world.IsReplay; + chatText.IsDisabled = () => world.IsReplay && !Game.Settings.Debug.EnableDebugCommandsInReplays; var keyListener = chatChrome.Get("KEY_LISTENER"); keyListener.OnKeyPress = e => diff --git a/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs index d9076d5768..0a4d114847 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs @@ -674,6 +674,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic BindCheckboxPref(panel, "FETCH_NEWS_CHECKBOX", gs, "FetchNews"); BindCheckboxPref(panel, "LUADEBUG_CHECKBOX", ds, "LuaDebug"); BindCheckboxPref(panel, "SENDSYSINFO_CHECKBOX", ds, "SendSystemInformation"); + BindCheckboxPref(panel, "REPLAY_COMMANDS_CHECKBOX", ds, "EnableDebugCommandsInReplays"); return () => { }; } diff --git a/mods/cnc/chrome/settings.yaml b/mods/cnc/chrome/settings.yaml index e96f300622..b834242a3b 100644 --- a/mods/cnc/chrome/settings.yaml +++ b/mods/cnc/chrome/settings.yaml @@ -585,6 +585,13 @@ Container@SETTINGS_PANEL: Height: 20 Font: Regular Text: Show Map Debug Messages + Checkbox@REPLAY_COMMANDS_CHECKBOX: + X: 310 + Y: 220 + Width: 300 + Height: 20 + Font: Regular + Text: Enable Debug Commands in Replays Button@BACK_BUTTON: Key: escape Y: 393 diff --git a/mods/common/chrome/settings.yaml b/mods/common/chrome/settings.yaml index b7647b2cc3..fe91668e25 100644 --- a/mods/common/chrome/settings.yaml +++ b/mods/common/chrome/settings.yaml @@ -586,3 +586,10 @@ Background@SETTINGS_PANEL: Height: 20 Font: Regular Text: Show Map Debug Messages + Checkbox@REPLAY_COMMANDS_CHECKBOX: + X: 310 + Y: 220 + Width: 300 + Height: 20 + Font: Regular + Text: Enable Debug Commands in Replays