From 62fd71c50edb2f7cfda5732b78a7677b68f3a365 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Fri, 24 Apr 2020 23:31:34 -0700 Subject: [PATCH] kay --- code/controllers/subsystem/input.dm | 59 +++++------------------- code/modules/keybindings/bindings_mob.dm | 17 ------- code/modules/mob/say.dm | 38 ++++++--------- interface/skin.dmf | 6 +-- tgstation.dme | 1 + 5 files changed, 28 insertions(+), 93 deletions(-) diff --git a/code/controllers/subsystem/input.dm b/code/controllers/subsystem/input.dm index ac27d43775..c6c03e2cbd 100644 --- a/code/controllers/subsystem/input.dm +++ b/code/controllers/subsystem/input.dm @@ -8,14 +8,6 @@ SUBSYSTEM_DEF(input) var/list/macro_sets var/list/movement_keys - /*! Special thing (until we get custom keybinds that also support clientside macros :weary:) that lets us do stuff like look up "which key is say/me bound to". Special format too, the value of a key should be list(key, modifier1, modifier2, ...). "default" unless override. - * USE get_key_for_macro_id or get_typing_indicator_binds TO ACCESS! - */ - var/list/macro_set_reverse_lookups - /// cache these for speed. - var/list/typing_indicator_binds - /// same - var/static/list/typing_indicator_verbs /datum/controller/subsystem/input/Initialize() setup_default_macro_sets() @@ -41,57 +33,35 @@ SUBSYSTEM_DEF(input) "Tab" = "\".winset \\\"input.focus=true?map.focus=true input.background-color=[COLOR_INPUT_DISABLED]:input.focus=true input.background-color=[COLOR_INPUT_ENABLED]\\\"\"", "O" = "ooc", "Ctrl+O" = "looc", - "T" = "say_keybind", - "Ctrl+T" = "whisper", - "M" = "me_keybind", - "Ctrl+M" = "subtle", + "T" = "Say", + "Ctrl+T" = "SayWithIndicator", + "Y" = "whisper", + "M" = "Me", + "Ctrl+M" = "MeWithIndicator", + "5" = "subtle", "Back" = "\".winset \\\"input.text=\\\"\\\"\\\"\"", // This makes it so backspace can remove default inputs "Any" = "\"KeyDown \[\[*\]\]\"", "Any+UP" = "\"KeyUp \[\[*\]\]\"", ), "old_default" = list( "Tab" = "\".winset \\\"mainwindow.macro=old_hotkeys map.focus=true input.background-color=[COLOR_INPUT_DISABLED]\\\"\"", - "Ctrl+T" = "say_keybind", + "Ctrl+T" = "Say", "Ctrl+O" = "ooc", ), "old_hotkeys" = list( "Tab" = "\".winset \\\"mainwindow.macro=old_default input.focus=true input.background-color=[COLOR_INPUT_ENABLED]\\\"\"", "O" = "ooc", "L" = "looc", - "T" = "say_keybind", - "M" = "me_keybind", + "T" = "Say", + "Ctrl+T" = "SayWithIndicator", + "M" = "Me", + "Ctrl+M" = "MeWithIndicator", "Back" = "\".winset \\\"input.text=\\\"\\\"\\\"\"", // This makes it so backspace can remove default inputs "Any" = "\"KeyDown \[\[*\]\]\"", "Any+UP" = "\"KeyUp \[\[*\]\]\"", ), ) - macro_set_reverse_lookups = list( - "default" = list( - "say_keybind" = list("T"), - "whisper" = list("T", "Ctrl"), - "me_keybind" = list("M"), - "subtle" = list("M", "Ctrl") - ), - "old_default" = list( - "say_keybind" = list("T", "Ctrl"), - ), - "old_hotkeys" = list( - "say_keybind" = list("T"), - "me_keybind" = list("M"), - ) - ) - - typing_indicator_verbs = list("me", "say", "say_keybind", "me_keybind") - typing_indicator_binds = list() - for(var/check_verb in typing_indicator_verbs) - for(var/macro_set in macro_set_reverse_lookups) - var/list/keylist = macro_set_reverse_lookups[macro_set][check_verb] - if(!keylist) - continue - var/key = keylist[1] - typing_indicator_binds[key] = TRUE - // Because i'm lazy and don't want to type all these out twice var/list/old_default = default_macro_sets["old_default"] @@ -151,10 +121,3 @@ SUBSYSTEM_DEF(input) for(var/i in 1 to length(clients)) var/client/C = clients[i] C.keyLoop() - -/datum/controller/subsystem/input/proc/get_key_for_macro_id(macro_id, macroset) - return macro_set_reverse_lookups[macroset][macro_id] || macro_set_reverse_lookups["default"][macro_id] - -/// Returns an associative list of keys without modifiers like ctrl. You have to do another lookup, this is for the first check to be faster. -/datum/controller/subsystem/input/proc/get_typing_indicator_binds(macroset) - return typing_indicator_binds[macroset] diff --git a/code/modules/keybindings/bindings_mob.dm b/code/modules/keybindings/bindings_mob.dm index cacb382d6a..36b4775c34 100644 --- a/code/modules/keybindings/bindings_mob.dm +++ b/code/modules/keybindings/bindings_mob.dm @@ -3,24 +3,7 @@ // Or we can have NPC's send actual keypresses and detect that by seeing no client /mob/key_down(_key, client/user) - if(SSinput.typing_indicator_binds[_key]) - var/macroset = winget(user, "mainwindow", "macro") - var/list/L = SSinput.macro_set_reverse_lookups[macroset] - var/valid = FALSE - for(var/the_verb in L) - if(the_verb in SSinput.typing_indicator_verbs) - var/list/keys = L[the_verb] - valid = TRUE - if(length(keys) > 1) - for(var/i in 2 to length(keys)) - if(!client.keys_held[keys[i]]) - valid = FALSE - break - if(valid) - display_typing_indicator() switch(_key) - if("Escape") //escape breaks out of clientside verb text input without executing at all, meaning we can't hook the verb to do this for us. - clear_typing_indicator() if("Delete", "H") if(!pulling) to_chat(src, "You are not pulling anything.") diff --git a/code/modules/mob/say.dm b/code/modules/mob/say.dm index 95e504aece..9679417ed8 100644 --- a/code/modules/mob/say.dm +++ b/code/modules/mob/say.dm @@ -1,55 +1,43 @@ //Speech verbs. // the _keybind verbs uses "as text" versus "as text|null" to force a popup when pressed by a keybind. -/mob/verb/say_keybind(message as text) - set name = "say_keybind" +/mob/verb/say_typing_indicator() + set name = "SayWithIndicator" set hidden = TRUE set category = "IC" + display_typing_indicator() + var/message = input(usr, "", "Say") as text|null // If they don't type anything just drop the message. clear_typing_indicator() // clear it immediately! if(!length(message)) return - return do_sayverb(message) + return say_verb(message) -/mob/verb/say_verb(message as text|null) +/mob/verb/say_verb(message as text) set name = "Say" set category = "IC" - display_typing_indicator() - if(!length(message)) - // We don't use input because that can't be broken out of with ESC key. - winset(src, null, "command=\"say_keybind\"") - else - return do_sayverb(message) - -/mob/proc/do_sayverb(message) - clear_typing_indicator() // clear it immediately! if(!length(message)) return if(GLOB.say_disabled) //This is here to try to identify lag problems to_chat(usr, "Speech is currently admin-disabled.") return + clear_typing_indicator() // clear it immediately! say(message) -/mob/verb/me_keybind(message as message) - set name = "me_keybind" +/mob/verb/me_typing_indicator() + set name = "MeWithIndicator" set hidden = TRUE set category = "IC" + display_typing_indicator() + var/message = input(usr, "", "Me") as message|null // If they don't type anything just drop the message. clear_typing_indicator() // clear it immediately! if(!length(message)) return - return do_meverb(message) + return me_verb(message) -/mob/verb/me_verb(message as message|null) +/mob/verb/me_verb(message as message) set name = "Me" set category = "IC" - display_typing_indicator() - if(!length(message)) - // Do not use input because it can't be broken out of with ESC key. - winset(src, null, "command=\"me_keybind\"") - else - return do_meverb(message) - -/mob/proc/do_meverb(message) clear_typing_indicator() // clear it immediately! if(!length(message)) return diff --git a/interface/skin.dmf b/interface/skin.dmf index 5f8e1ad125..f27b0bcf48 100644 --- a/interface/skin.dmf +++ b/interface/skin.dmf @@ -1,5 +1,6 @@ macro "default" + menu "menu" elem name = "&File" @@ -268,14 +269,13 @@ window "statwindow" is-default = true saved-params = "" - window "preferences_window" +window "preferences_window" elem "preferences_window" type = MAIN pos = 372,0 size = 1280x1000 anchor1 = none anchor2 = none - background-color = none is-visible = false saved-params = "pos;size;is-minimized;is-maximized" statusbar = false @@ -285,7 +285,6 @@ window "statwindow" size = 960x1000 anchor1 = 0,0 anchor2 = 75,100 - background-color = none saved-params = "" elem "character_preview_map" type = MAP @@ -295,3 +294,4 @@ window "statwindow" anchor2 = 100,100 right-click = true saved-params = "zoom;letterbox;zoom-mode" + diff --git a/tgstation.dme b/tgstation.dme index 107a704c4b..0f54c8cb5d 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -3253,6 +3253,7 @@ #include "interface\interface.dm" #include "interface\menu.dm" #include "interface\stylesheet.dm" +#include "interface\skin.dmf" #include "modular_citadel\code\__HELPERS\list2list.dm" #include "modular_citadel\code\__HELPERS\lists.dm" #include "modular_citadel\code\__HELPERS\mobs.dm"