Files
Paradise/code/modules/mob/typing_indicator.dm
S34N 3be2d5f8b6 TGUI say: Upgrades chat input with modern features (#23907)
* initial stuff (broken)

* initial stuff (works)

* fix most other things

* fix thinking indicator

* file name moment

* contra review

* better logs

* snowball feedback

* expanded drag handles

* Update code/modules/tgui_input/say_modal/tgui_say_modal.dm

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>

* Update code/modules/tgui_input/say_modal/tgui_say_modal.dm

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>

* Drag handle

* fix missing colours

* TGUI rebuild (im clever)

* Make msay useable by admins again (i hope)

* fixed blacklist channel leaks due to lack of user eyes

* clear old TGUIsay macros on keybind update

* TGUI say tweaks

* Update code/modules/tgui_input/say_modal/tgui_say_modal.dm

* whisper is now a channel

* remove placeholder, shorten width

* tidies prefs, fix lightmode, refactor typing/thinking indicators

* clarify more prefs

* TG Typing Indicators and increace layer

* modifiers?

* makes the TGUI say macros serverside

* add checks for muted stuff

* dgamer review

* fix talk and type issue

* Update code/datums/keybindings/communication_keybinds.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>

* review and binary stuff

* Removes force say from TGUI say

* updated

* Apply suggestions from code review

Co-authored-by: Aylong <69762909+AyIong@users.noreply.github.com>

* remove verb

* le rebuild

* better behaviour on illegal entries

---------

Co-authored-by: Aylong <alexanderkitsa@gmail.com>
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Co-authored-by: GDN <Roanrichards1@Gmail.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: Aylong <69762909+AyIong@users.noreply.github.com>
2024-02-15 19:31:29 +01:00

111 lines
3.2 KiB
Plaintext

GLOBAL_LIST_EMPTY(typing_indicator)
GLOBAL_LIST_EMPTY(thinking_indicator)
/**
* Toggles the floating chat bubble above a players head.
*
* Arguments:
* * state - Should a chat bubble be shown or hidden
* * me - Is the bubble being caused by the 'me' emote command
*/
/mob/proc/set_typing_indicator(state, me)
if(!GLOB.typing_indicator[bubble_icon])
GLOB.typing_indicator[bubble_icon] = image('icons/mob/talk.dmi', null, "[bubble_icon]_typing", ABOVE_HUD_LAYER)
var/image/I = GLOB.typing_indicator[bubble_icon]
I.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
if(ishuman(src) && !me)
var/mob/living/carbon/human/H = src
if(HAS_TRAIT(H, TRAIT_MUTE))
overlays -= GLOB.typing_indicator[bubble_icon]
typing = FALSE
return FALSE
if(!client)
return FALSE
if(stat != CONSCIOUS || is_muzzled() || (client.prefs.toggles & PREFTOGGLE_SHOW_TYPING))
overlays -= GLOB.typing_indicator[bubble_icon]
typing = FALSE
return FALSE
if(state && !typing)
overlays += GLOB.typing_indicator[bubble_icon]
typing = TRUE
if(!state && typing)
overlays -= GLOB.typing_indicator[bubble_icon]
typing = FALSE
return state
/**
* Toggles the floating thought bubble above a players head.
*
* Arguments:
* * state - Should a thought bubble be shown or hidden
*/
/mob/proc/set_thinking_indicator(state)
if(!GLOB.thinking_indicator[bubble_icon])
GLOB.thinking_indicator[bubble_icon] = image('icons/mob/talk.dmi', null, "[bubble_icon]_thinking", ABOVE_HUD_LAYER)
var/image/I = GLOB.thinking_indicator[bubble_icon]
I.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
if(!client && !isliving(src))
return FALSE
if(stat != CONSCIOUS || (client.prefs.toggles & PREFTOGGLE_SHOW_TYPING))
overlays -= GLOB.thinking_indicator[bubble_icon]
thinking = FALSE
return FALSE
if(!state && thinking)
overlays -= GLOB.thinking_indicator[bubble_icon]
thinking = FALSE
if(state && !thinking)
overlays += GLOB.thinking_indicator[bubble_icon]
thinking = TRUE
return state
/mob/verb/say_wrapper()
set name = ".Say"
set hidden = TRUE
set_typing_indicator(TRUE)
typing = TRUE
var/message = typing_input(src, "", "say (text)")
typing = FALSE
set_typing_indicator(FALSE)
if(message)
say_verb(message)
/mob/verb/me_wrapper()
set name = ".Me"
set hidden = TRUE
set_typing_indicator(TRUE, TRUE)
typing = TRUE
var/message = typing_input(src, "", "me (text)")
typing = FALSE
set_typing_indicator(FALSE)
if(message)
me_verb(message)
/client/verb/typing_indicator()
set name = "Show/Hide Typing Indicator"
set category = "Preferences"
set desc = "Toggles showing a typing/thought indicator when you have TGUIsay open."
prefs.toggles ^= PREFTOGGLE_SHOW_TYPING
prefs.save_preferences(src)
to_chat(src, "You will [(prefs.toggles & PREFTOGGLE_SHOW_TYPING) ? "no longer" : "now"] display a typing/thought indicator when you have TGUIsay open.")
// Clear out any existing typing indicator.
if(prefs.toggles & PREFTOGGLE_SHOW_TYPING)
if(istype(mob))
mob.set_typing_indicator(FALSE)
mob.set_thinking_indicator(FALSE)
SSblackbox.record_feedback("tally", "toggle_verbs", 1, "Toggle Typing Indicator (Speech)") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!