Files
sunny 3e4b00bee8 Abductors have typing indicators (#4846)
## About The Pull Request
Abductors, while "talking" and emoting, have typing indicators.
<img width="114" height="138" alt="image"
src="https://github.com/user-attachments/assets/b48c8647-a96f-4a81-b117-9c13c58863fd"
/>
## Why It's Good For The Game
Removes the inherent type-baiting abductor players face by other people
literally being unable to know they're typing. They still can't talk to
other people, this just shows the little bubble. _Technically_ an
abductor-antag nerf, but it's so minor and adds QoL, I think it's very
worth it.
## Proof Of Testing
Compiles.
<details>
<summary>Screenshots/Videos</summary>

</details>

## Changelog
🆑 sunnyaries
add:onlookers may know when an abductor is emoting. millions must gleep
/🆑
2025-10-25 00:27:48 +03:00

73 lines
2.1 KiB
Plaintext

#define IC_VERBS list("say", "me", "whisper")
/client/var/commandbar_thinking = FALSE
/client/var/commandbar_typing = FALSE
/client/proc/initialize_commandbar_spy()
src << output('html/typing_indicator.html', "commandbar_spy")
/client/proc/handle_commandbar_typing(href_list)
if (!typing_indicators) //check pref
return
if (length(href_list["verb"]) < 1 || !(LOWER_TEXT(href_list["verb"]) in IC_VERBS) || text2num(href_list["argument_length"]) < 1)
if (commandbar_typing)
commandbar_typing = FALSE
stop_typing()
if (commandbar_thinking)
commandbar_thinking = FALSE
stop_thinking()
return
if (!commandbar_thinking)
commandbar_thinking = TRUE
start_thinking()
if (!commandbar_typing)
commandbar_typing = TRUE
start_typing()
/** Sets the mob as "thinking" - with indicator and the TRAIT_THINKING_IN_CHARACTER trait */
/client/proc/start_thinking()
if(!typing_indicators)
return FALSE
/// Special exemptions
/* BUBBER EDIT REMOVAL BEGIN
if(isabductor(mob))
return FALSE
END */
ADD_TRAIT(mob, TRAIT_THINKING_IN_CHARACTER, CURRENTLY_TYPING_TRAIT)
mob.create_thinking_indicator()
/** Removes typing/thinking indicators and flags the mob as not thinking */
/client/proc/stop_thinking()
mob?.remove_all_indicators()
/**
* Handles the user typing. After a brief period of inactivity,
* signals the client mob to revert to the "thinking" icon.
*/
/client/proc/start_typing()
var/mob/client_mob = mob
client_mob.remove_thinking_indicator()
if(!typing_indicators || !HAS_TRAIT(client_mob, TRAIT_THINKING_IN_CHARACTER))
return FALSE
client_mob.create_typing_indicator()
addtimer(CALLBACK(src, PROC_REF(stop_typing)), 5 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_STOPPABLE)
/**
* Callback to remove the typing indicator after a brief period of inactivity.
* If the user was typing IC, the thinking indicator is shown.
*/
/client/proc/stop_typing()
if(isnull(mob))
return FALSE
var/mob/client_mob = mob
client_mob.remove_typing_indicator()
if(!typing_indicators || !HAS_TRAIT(client_mob, TRAIT_THINKING_IN_CHARACTER))
return FALSE
client_mob.create_thinking_indicator()
#undef IC_VERBS