This commit is contained in:
kevinz000
2020-03-04 06:03:51 -07:00
parent e243dc689b
commit 1ae4ef16bc
3 changed files with 18 additions and 8 deletions
+3 -1
View File
@@ -14,6 +14,8 @@ SUBSYSTEM_DEF(input)
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()
@@ -80,8 +82,8 @@ SUBSYSTEM_DEF(input)
)
)
typing_indicator_verbs = list("me", "say")
typing_indicator_binds = list()
var/static/list/typing_indicator_verbs = list("me", "say")
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]
+14 -6
View File
@@ -3,15 +3,22 @@
// Or we can have NPC's send actual keypresses and detect that by seeing no client
/mob/key_down(_key, client/user)
to_chat(world, "DEBUG: key_down [_key]")
if(SSinput.typing_indicator_binds[_key])
var/macroset = winget(user, "mainwindow", "macro")
var/list/L = SSinput.macro_set_reverse_lookups[macroset]
var/valid = TRUE
if(length(L) > 1)
for(var/i in 2 to length(L))
if(!client.keys_held[L[i]])
valid = FALSE
break
to_chat(world, "DEBUG: Looking up list [macroset] = [english_list(L)]")
to_chat(world, "DEBUG: Client.keys_held = [english_list(client.keys_held)]")
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)
@@ -86,6 +93,7 @@
return ..()
/mob/key_up(_key, client/user)
to_chat(world, "DEBUG: key_up [_key]")
switch(_key)
if("Alt")
toggle_move_intent()
+1 -1
View File
@@ -39,6 +39,6 @@ GLOBAL_LIST_EMPTY(typing_indicator_overlays)
/obj/effect/overlay/typing_indicator
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
icon = 'icons/mob/talk.dmi'
icon_state = "default_typing"
icon_state = "normal_typing"
appearance_flags = RESET_COLOR | TILE_BOUND | PIXEL_SCALE
layer = LARGE_MOB_LAYER