Moves thinking_IC variable to a trait (#80122)

## About The Pull Request

This was another boolean that was used to just manage stuff codeside
that really was not accessed _too_ much and is ultimately not useful as
a variable on `/mob`. This just moves it to a trait because it's only
really used in a few spots for a similar intent+purpose.
## Why It's Good For The Game

Less stuff to deal with in the average view variables window whenever
looking at a mob, which is really nice and welcome.
## Changelog
Doesn't concern players.
This commit is contained in:
san7890
2023-12-05 02:22:07 -05:00
committed by GitHub
parent 3ee0c2f890
commit 904c81bbcd
6 changed files with 24 additions and 17 deletions
+14 -12
View File
@@ -36,14 +36,14 @@
/datum/preference/toggle/typing_indicator/apply_to_client(client/client, value)
client?.typing_indicators = value
/** Sets the mob as "thinking" - with indicator and variable thinking_IC */
/** Sets the mob as "thinking" - with indicator and the TRAIT_THINKING_IN_CHARACTER trait */
/datum/tgui_say/proc/start_thinking()
if(!window_open || !client.typing_indicators)
return FALSE
/// Special exemptions
if(isabductor(client.mob))
return FALSE
client.mob.thinking_IC = TRUE
ADD_TRAIT(client.mob, TRAIT_THINKING_IN_CHARACTER, CURRENTLY_TYPING_TRAIT)
client.mob.create_thinking_indicator()
/** Removes typing/thinking indicators and flags the mob as not thinking */
@@ -55,10 +55,11 @@
* signals the client mob to revert to the "thinking" icon.
*/
/datum/tgui_say/proc/start_typing()
client.mob.remove_thinking_indicator()
if(!window_open || !client.typing_indicators || !client.mob.thinking_IC)
var/mob/client_mob = client.mob
client_mob.remove_thinking_indicator()
if(!window_open || !client.typing_indicators || !HAS_TRAIT(client_mob, TRAIT_THINKING_IN_CHARACTER))
return FALSE
client.mob.create_typing_indicator()
client_mob.create_typing_indicator()
addtimer(CALLBACK(src, PROC_REF(stop_typing)), 5 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_STOPPABLE)
/**
@@ -66,29 +67,31 @@
* If the user was typing IC, the thinking indicator is shown.
*/
/datum/tgui_say/proc/stop_typing()
if(!client?.mob)
if(isnull(client?.mob))
return FALSE
client.mob.remove_typing_indicator()
if(!window_open || !client.typing_indicators || !client.mob.thinking_IC)
var/mob/client_mob = client.mob
client_mob.remove_typing_indicator()
if(!window_open || !client.typing_indicators || !HAS_TRAIT(client_mob, TRAIT_THINKING_IN_CHARACTER))
return FALSE
client.mob.create_thinking_indicator()
client_mob.create_thinking_indicator()
/// Overrides for overlay creation
/mob/living/create_thinking_indicator()
if(active_thinking_indicator || active_typing_indicator || !thinking_IC || stat != CONSCIOUS )
if(active_thinking_indicator || active_typing_indicator || stat != CONSCIOUS || !HAS_TRAIT(src, TRAIT_THINKING_IN_CHARACTER))
return FALSE
active_thinking_indicator = mutable_appearance('icons/mob/effects/talk.dmi', "[bubble_icon]3", TYPING_LAYER)
add_overlay(active_thinking_indicator)
play_fov_effect(src, 6, "talk", ignore_self = TRUE)
/mob/living/remove_thinking_indicator()
REMOVE_TRAIT(src, TRAIT_THINKING_IN_CHARACTER, CURRENTLY_TYPING_TRAIT)
if(!active_thinking_indicator)
return FALSE
cut_overlay(active_thinking_indicator)
active_thinking_indicator = null
/mob/living/create_typing_indicator()
if(active_typing_indicator || active_thinking_indicator || !thinking_IC || stat != CONSCIOUS)
if(active_typing_indicator || active_thinking_indicator || stat != CONSCIOUS || !HAS_TRAIT(src, TRAIT_THINKING_IN_CHARACTER))
return FALSE
active_typing_indicator = mutable_appearance('icons/mob/effects/talk.dmi', "[bubble_icon]0", TYPING_LAYER)
add_overlay(active_typing_indicator)
@@ -101,7 +104,6 @@
active_typing_indicator = null
/mob/living/remove_all_indicators()
thinking_IC = FALSE
remove_thinking_indicator()
remove_typing_indicator()