From 515c3b4b29b2a5dd0de7bb4b88f357d6cb5131d0 Mon Sep 17 00:00:00 2001 From: Runa Dacino Date: Sun, 2 Jul 2023 17:17:57 +0200 Subject: [PATCH] feature(TGUI input): Adds preference toggle for input lock Adds a new verb under the Preferences verb tab, "Togle-TGUI-Input-Lock" that when pressed/called from command line invert the present preference from TRUE to FALSE and vice versa, saves it to persist and notifies the user that they have enabled/disabled it and what this setting does. This was done using a simple var = !var rather than the toggle_preference() proc as none of the TGUI preferences have a preference datum. I believe this is due to the way they're positioned in the character set-up window (they're on the top rather than the bottom). As such, I felt it best not to create a datum just for this. The reason we need this is that although inserting newlines is great when RPing in a slower paced, heavier setting - fast-paced interactions become unnecessarily clunky with the input lock and opening character setup to toggle it back and forth is tiresome. This way, players can just press a button during gameplay or type "Toggle-TGU" and press space to autocomplete. --- code/modules/client/preferences_toggle_procs.dm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/modules/client/preferences_toggle_procs.dm b/code/modules/client/preferences_toggle_procs.dm index 4b52562c414..07014c99a3d 100644 --- a/code/modules/client/preferences_toggle_procs.dm +++ b/code/modules/client/preferences_toggle_procs.dm @@ -379,6 +379,17 @@ You will have to reload VChat and/or reconnect to the server for these changes to take place. \ VChat message persistence is not guaranteed if you change this again before the start of the next round.") +/client/verb/toggle_tgui_inputlock() + set name = "Toggle TGUI Input Lock" + set category = "Preferences" + set desc = "Toggles whether or not pressing the 'Enter' key in TGUI input sends the message or creates a new line." + + prefs.tgui_input_lock = !prefs.tgui_input_lock //There is no preference datum for tgui input lock, nor for any TGUI prefs. + SScharacter_setup.queue_preferences_save(prefs) + + to_chat(src, span_notice("You have toggled TGUI input lock: [prefs.tgui_input_lock ? "ON" : "OFF"] \n \ + This setting determines whether pressing enter on TGUI input sends the input, or creates a newline.")) + /client/verb/toggle_status_indicators() set name = "Toggle Status Indicators" set category = "Preferences"