From 315f0ced2e2de76962204e613ae227ab02d846e7 Mon Sep 17 00:00:00 2001 From: TankNut Date: Mon, 24 Jul 2023 19:05:10 +0200 Subject: [PATCH] escCloseMenu option --- gamemode/config/sh_options.lua | 4 ++++ gamemode/core/derma/cl_menu.lua | 4 ++++ gamemode/languages/sh_english.lua | 2 ++ 3 files changed, 10 insertions(+) diff --git a/gamemode/config/sh_options.lua b/gamemode/config/sh_options.lua index 62eaced0d..9b05e6dda 100644 --- a/gamemode/config/sh_options.lua +++ b/gamemode/config/sh_options.lua @@ -43,6 +43,10 @@ if (CLIENT) then ix.option.Add("showIntro", ix.type.bool, true, { category = "general" }) + + ix.option.Add("escCloseMenu", ix.type.bool, false, { + category = "general" + }) end ix.option.Add("language", ix.type.array, ix.config.language or "english", { diff --git a/gamemode/core/derma/cl_menu.lua b/gamemode/core/derma/cl_menu.lua index 008d93df4..35b49f096 100644 --- a/gamemode/core/derma/cl_menu.lua +++ b/gamemode/core/derma/cl_menu.lua @@ -386,6 +386,10 @@ function PANEL:Think() if ((!self.anchorMode and !bTabDown) or gui.IsGameUIVisible()) then self:Remove() + + if (ix.option.Get("escCloseMenu", false)) then + gui.HideGameUI() + end end end diff --git a/gamemode/languages/sh_english.lua b/gamemode/languages/sh_english.lua index ae180be05..5d1a09c80 100644 --- a/gamemode/languages/sh_english.lua +++ b/gamemode/languages/sh_english.lua @@ -387,6 +387,8 @@ LANGUAGE = { optdChatFontScale = "How much bigger or smaller the chat font should be.", optChatOutline = "Outline chat text", optdChatOutline = "Draws an outline around the chat text, rather than a drop shadow. Enable this if you are having trouble reading text.", + optEscCloseMenu = "Escape returns to game", + optdEscCloseMenu = "Whether the escape menu should close itself when you're using it to close the in-game menu.", cmdRoll = "Rolls a number between 0 and the specified number.", cmdPM = "Sends a private message to someone.",