mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Added tracking of inactivity in chatbar.
Now indicator will disappear if for 30 seconds contents of chatbar didn't change. Moved all relevant vars to the typing_indicator.dm Added 'typing' var, as 'if(!(typing_indicator in overlays))' didn't work and overlays kept being added forever. Fixed preference toggle feedback being backwards. Fixed wrong verb called in hotkeys mode.
This commit is contained in:
@@ -220,4 +220,3 @@
|
|||||||
var/turf/listed_turf = null //the current turf being examined in the stat panel
|
var/turf/listed_turf = null //the current turf being examined in the stat panel
|
||||||
|
|
||||||
var/list/active_genes=list()
|
var/list/active_genes=list()
|
||||||
var/hud_typing = 0 //set when typing in an input window instead of chatline
|
|
||||||
@@ -1,3 +1,10 @@
|
|||||||
|
#define TYPING_INDICATOR_LIFETIME 30 * 10 //grace period after which typing indicator disappears regardless of text in chatbar
|
||||||
|
|
||||||
|
mob/var/hud_typing = 0 //set when typing in an input window instead of chatline
|
||||||
|
mob/var/typing
|
||||||
|
mob/var/last_typed
|
||||||
|
mob/var/last_typed_time
|
||||||
|
|
||||||
var/global/image/typing_indicator
|
var/global/image/typing_indicator
|
||||||
|
|
||||||
/mob/proc/set_typing_indicator(var/state)
|
/mob/proc/set_typing_indicator(var/state)
|
||||||
@@ -6,10 +13,13 @@ var/global/image/typing_indicator
|
|||||||
if(!typing_indicator)
|
if(!typing_indicator)
|
||||||
typing_indicator = image('icons/mob/talk.dmi',null,"typing")
|
typing_indicator = image('icons/mob/talk.dmi',null,"typing")
|
||||||
if(state)
|
if(state)
|
||||||
if(!(typing_indicator in overlays))
|
if(!typing)
|
||||||
overlays += typing_indicator
|
overlays += typing_indicator
|
||||||
|
typing = 1
|
||||||
else
|
else
|
||||||
overlays -= typing_indicator
|
if(typing)
|
||||||
|
overlays -= typing_indicator
|
||||||
|
typing = 0
|
||||||
return state
|
return state
|
||||||
|
|
||||||
/mob/verb/say_wrapper()
|
/mob/verb/say_wrapper()
|
||||||
@@ -40,10 +50,19 @@ var/global/image/typing_indicator
|
|||||||
if(client)
|
if(client)
|
||||||
if(!(client.prefs.toggles & SHOW_TYPING) && !hud_typing)
|
if(!(client.prefs.toggles & SHOW_TYPING) && !hud_typing)
|
||||||
var/temp = winget(client, "input", "text")
|
var/temp = winget(client, "input", "text")
|
||||||
|
|
||||||
|
if (temp != last_typed)
|
||||||
|
last_typed = temp
|
||||||
|
last_typed_time = world.time
|
||||||
|
|
||||||
|
if (world.time > last_typed_time + TYPING_INDICATOR_LIFETIME)
|
||||||
|
set_typing_indicator(0)
|
||||||
|
return
|
||||||
if(length(temp) > 5 && findtext(temp, "Say \"", 1, 7))
|
if(length(temp) > 5 && findtext(temp, "Say \"", 1, 7))
|
||||||
set_typing_indicator(1)
|
set_typing_indicator(1)
|
||||||
else if(length(temp) > 3 && findtext(temp, "Me ", 1, 5))
|
else if(length(temp) > 3 && findtext(temp, "Me ", 1, 5))
|
||||||
set_typing_indicator(1)
|
set_typing_indicator(1)
|
||||||
|
|
||||||
else
|
else
|
||||||
set_typing_indicator(0)
|
set_typing_indicator(0)
|
||||||
|
|
||||||
@@ -53,5 +72,5 @@ var/global/image/typing_indicator
|
|||||||
set desc = "Toggles showing an indicator when you are typing emote or say message."
|
set desc = "Toggles showing an indicator when you are typing emote or say message."
|
||||||
prefs.toggles ^= SHOW_TYPING
|
prefs.toggles ^= SHOW_TYPING
|
||||||
prefs.save_preferences()
|
prefs.save_preferences()
|
||||||
src << "You will [(prefs.toggles & CHAT_OOC) ? "now" : "no longer"] display typing indicator."
|
src << "You will [(prefs.toggles & CHAT_OOC) ? "no longer" : "now"] display typing indicator."
|
||||||
feedback_add_details("admin_verb","TID") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
feedback_add_details("admin_verb","TID") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||||
|
|||||||
@@ -403,11 +403,11 @@ macro "hotkeymode"
|
|||||||
is-disabled = false
|
is-disabled = false
|
||||||
elem
|
elem
|
||||||
name = "F3"
|
name = "F3"
|
||||||
command = "say_wrapper"
|
command = ".say"
|
||||||
is-disabled = false
|
is-disabled = false
|
||||||
elem
|
elem
|
||||||
name = "F4"
|
name = "F4"
|
||||||
command = "me_wrapper"
|
command = ".me"
|
||||||
is-disabled = false
|
is-disabled = false
|
||||||
elem
|
elem
|
||||||
name = "F5"
|
name = "F5"
|
||||||
|
|||||||
Reference in New Issue
Block a user