From 6e549bfed230b552e0775296ba06f87a86b3f3d2 Mon Sep 17 00:00:00 2001 From: elexis Date: Thu, 11 May 2017 22:49:54 +0000 Subject: [PATCH] Prohibit cheats if cheats are disabled, i.e. developer cheats to control enemy units, revealing the map and promoting units too. Open the developer overlay only if cheats are enabled (which is always the case in singleplayer mode and only the case in multiplayer mode if explicitly enabled). (This doesn't make it harder for developers to "debug", since they previously had to remember to disable the rated game setting too. Also every bug had to be reproduced with the replay either way) Reverts 3cbbf31173 which reverted 6e0e607b20 (since as of c288278229, the autostart gamesetup enables cheats too). Differential Revision: https://code.wildfiregames.com/D455 Fixes #3551 Reviewed By: echotangoecho Agreed with Itms and Imarok in the last staff meeting. This was SVN commit r19558. --- binaries/data/mods/public/gui/session/menu.js | 3 +-- binaries/data/mods/public/simulation/helpers/Commands.js | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/binaries/data/mods/public/gui/session/menu.js b/binaries/data/mods/public/gui/session/menu.js index a4f09d0c9f..41b76cbcef 100644 --- a/binaries/data/mods/public/gui/session/menu.js +++ b/binaries/data/mods/public/gui/session/menu.js @@ -1121,8 +1121,7 @@ function openManual() function toggleDeveloperOverlay() { - // The developer overlay is disabled in ranked games - if (Engine.HasXmppClient() && Engine.IsRankedGame()) + if (!g_GameAttributes.settings.CheatsEnabled) return; let devCommands = Engine.GetGUIObjectByName("devCommands"); diff --git a/binaries/data/mods/public/simulation/helpers/Commands.js b/binaries/data/mods/public/simulation/helpers/Commands.js index fbed19e95d..f455e9643a 100644 --- a/binaries/data/mods/public/simulation/helpers/Commands.js +++ b/binaries/data/mods/public/simulation/helpers/Commands.js @@ -114,6 +114,9 @@ var g_Commands = { "control-all": function(player, cmd, data) { + if (!data.cmpPlayer.GetCheatsEnabled()) + return; + var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); cmpGuiInterface.PushNotification({ "type": "aichat", @@ -126,6 +129,9 @@ var g_Commands = { "reveal-map": function(player, cmd, data) { + if (!data.cmpPlayer.GetCheatsEnabled()) + return; + var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); cmpGuiInterface.PushNotification({ "type": "aichat", @@ -563,6 +569,9 @@ var g_Commands = { "promote": function(player, cmd, data) { + if (!data.cmpPlayer.GetCheatsEnabled()) + return; + var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); cmpGuiInterface.PushNotification({ "type": "aichat",