From 3bab2fd80329136f5e591b7d207f0bd5387973c2 Mon Sep 17 00:00:00 2001 From: ike709 Date: Mon, 6 Jul 2020 08:45:58 -0500 Subject: [PATCH] Focus OOC hotkey (#1272) --- Content.Client/Input/ContentContexts.cs | 1 + Content.Client/State/GameScreen.cs | 14 ++++++++++++++ Content.Client/UserInterface/TutorialWindow.cs | 4 +++- Content.Shared/Input/ContentKeyFunctions.cs | 1 + Resources/keybinds.yml | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Content.Client/Input/ContentContexts.cs b/Content.Client/Input/ContentContexts.cs index f9636dc01f..5e54b537dc 100644 --- a/Content.Client/Input/ContentContexts.cs +++ b/Content.Client/Input/ContentContexts.cs @@ -13,6 +13,7 @@ namespace Content.Client.Input { var common = contexts.GetContext("common"); common.AddFunction(ContentKeyFunctions.FocusChat); + common.AddFunction(ContentKeyFunctions.FocusOOC); common.AddFunction(ContentKeyFunctions.ExamineEntity); common.AddFunction(ContentKeyFunctions.OpenTutorial); common.AddFunction(ContentKeyFunctions.TakeScreenshot); diff --git a/Content.Client/State/GameScreen.cs b/Content.Client/State/GameScreen.cs index 3deb982aae..5d5ff40f04 100644 --- a/Content.Client/State/GameScreen.cs +++ b/Content.Client/State/GameScreen.cs @@ -41,6 +41,9 @@ namespace Content.Client.State _inputManager.SetInputCommand(ContentKeyFunctions.FocusChat, InputCmdHandler.FromDelegate(s => FocusChat(_gameChat))); + + _inputManager.SetInputCommand(ContentKeyFunctions.FocusOOC, + InputCmdHandler.FromDelegate(s => FocusOOC(_gameChat))); } public override void Shutdown() @@ -61,5 +64,16 @@ namespace Content.Client.State chat.Input.IgnoreNext = true; chat.Input.GrabKeyboardFocus(); } + internal static void FocusOOC(ChatBox chat) + { + if (chat == null || chat.UserInterfaceManager.KeyboardFocused != null) + { + return; + } + + chat.Input.IgnoreNext = true; + chat.Input.GrabKeyboardFocus(); + chat.Input.InsertAtCursor("["); + } } } diff --git a/Content.Client/UserInterface/TutorialWindow.cs b/Content.Client/UserInterface/TutorialWindow.cs index af54907d57..ce9362a62c 100644 --- a/Content.Client/UserInterface/TutorialWindow.cs +++ b/Content.Client/UserInterface/TutorialWindow.cs @@ -75,6 +75,7 @@ Open inventory: [color=#a4885c]{7}[/color] Open character window: [color=#a4885c]{8}[/color] Open crafting window: [color=#a4885c]{9}[/color] Focus chat: [color=#a4885c]{10}[/color] +Focus OOC: [color=#a4885c]{26}[/color] Use hand/object in hand: [color=#a4885c]{22}[/color] Do wide attack: [color=#a4885c]{23}[/color] Use targeted entity: [color=#a4885c]{11}[/color] @@ -110,7 +111,8 @@ Toggle sandbox window: [color=#a4885c]{21}[/color]", Key(Use), Key(WideAttack), Key(SmartEquipBackpack), - Key(SmartEquipBelt))); + Key(SmartEquipBelt), + Key(FocusOOC))); //Gameplay VBox.AddChild(new Label { FontOverride = headerFont, Text = "\nGameplay" }); diff --git a/Content.Shared/Input/ContentKeyFunctions.cs b/Content.Shared/Input/ContentKeyFunctions.cs index d44cb1d64d..bdbc7cee49 100644 --- a/Content.Shared/Input/ContentKeyFunctions.cs +++ b/Content.Shared/Input/ContentKeyFunctions.cs @@ -11,6 +11,7 @@ namespace Content.Shared.Input public static readonly BoundKeyFunction Drop = "Drop"; public static readonly BoundKeyFunction ExamineEntity = "ExamineEntity"; public static readonly BoundKeyFunction FocusChat = "FocusChatWindow"; + public static readonly BoundKeyFunction FocusOOC = "FocusOOCWindow"; public static readonly BoundKeyFunction OpenCharacterMenu = "OpenCharacterMenu"; public static readonly BoundKeyFunction OpenContextMenu = "OpenContextMenu"; public static readonly BoundKeyFunction OpenCraftingMenu = "OpenCraftingMenu"; diff --git a/Resources/keybinds.yml b/Resources/keybinds.yml index 29388101ed..5c2a9da3c3 100644 --- a/Resources/keybinds.yml +++ b/Resources/keybinds.yml @@ -43,6 +43,9 @@ binds: - function: FocusChatWindow type: State key: T +- function: FocusOOCWindow + type: State + key: LBracket - function: EditorLinePlace type: State key: MouseLeft