Typing indicators
This commit is contained in:
@@ -106,6 +106,9 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
|
||||
var/whitelist = list() //List the ckeys that can use this species, if it's whitelisted.: list("John Doe", "poopface666", "SeeALiggerPullTheTrigger") Spaces & capitalization can be included or ignored entirely for each key as it checks for both.
|
||||
var/should_draw_citadel = FALSE
|
||||
|
||||
/// Our default override for typing indicator state
|
||||
var/typing_indicator_state
|
||||
|
||||
///////////
|
||||
// PROCS //
|
||||
///////////
|
||||
@@ -2218,3 +2221,8 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
|
||||
/datum/species/proc/start_wagging_tail(mob/living/carbon/human/H)
|
||||
|
||||
/datum/species/proc/stop_wagging_tail(mob/living/carbon/human/H)
|
||||
|
||||
|
||||
/////// TYPING INDICATORS ///////
|
||||
/datum/species/proc/get_typing_indicator_state()
|
||||
return typing_indicator_state
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
/mob/living/carbon/human/get_typing_indicator_icon_state()
|
||||
return dna?.species?.get_typing_indicator_state() || ..()
|
||||
@@ -354,7 +354,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
|
||||
|
||||
if(cultslurring)
|
||||
message = cultslur(message)
|
||||
|
||||
|
||||
if(clockcultslurring)
|
||||
message = CLOCK_CULT_SLUR(message)
|
||||
|
||||
|
||||
@@ -128,3 +128,13 @@
|
||||
|
||||
var/flavor_text = ""
|
||||
var/flavor_text_2 = "" //version of the above that only lasts for the current round.
|
||||
|
||||
///////TYPING INDICATORS///////
|
||||
/// Set to true if we want to show typing indicators.
|
||||
var/typing_indicator_enabled = FALSE
|
||||
/// Default icon_state of our typing indicator. Currently only supports paths (because anything else is, as of time of typing this, unnecesary.
|
||||
var/typing_indicator_state = /obj/effect/overlay/typing_indicator
|
||||
/// The timer that will remove our indicator for early aborts (like when an user finishes their message)
|
||||
var/typing_indicator_timerid
|
||||
/// Default typing indicator timeout
|
||||
var/typing_indicator_timeout = 30 SECONDS
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/// state = overlay/image/object/type/whatever add_overlay will accept
|
||||
GLOBAL_LIST_EMPTY(typing_indicator_overlays)
|
||||
|
||||
/// Fetches the typing indicator we'll use from GLOB.typing_indicator_overlays
|
||||
/mob/proc/get_indicator_overlay(state)
|
||||
. = GLOB.typing_indicator_overlays[state]
|
||||
if(.)
|
||||
return
|
||||
// doesn't exist, make it and cache it
|
||||
if(ispath(state))
|
||||
. = GLOB.typing_indicator_overlays[state] = state
|
||||
// We only support paths for now because anything else isn't necessary yet.
|
||||
|
||||
/// Gets the state we will use for typing indicators. Defaults to src.typing_indicator_state
|
||||
/mob/proc/get_typing_indicator_icon_state()
|
||||
return typing_indicator_state
|
||||
|
||||
/*!
|
||||
* Displays typing indicator.
|
||||
* @param timeout_override - Sets how long until this will disappear on its own without the user finishing their message or logging out. Defaults to src.typing_indicator_timeout
|
||||
* @param state_override - Sets the state that we will fetch. Defaults to src.get_typing_indicator_icon_state()
|
||||
* @param force - shows even if src.typing_indcator_enabled is FALSE.
|
||||
*/
|
||||
/mob/proc/display_typing_indicator(timeout_override = typing_indicator_timeout, state_override = get_typing_indicator_icon_state(), force = FALSE)
|
||||
if(!typing_indicator_enabled || force)
|
||||
return
|
||||
add_overlay(get_indicator_overlay(state_override))
|
||||
addtimer(CALLBACK(src, .proc/clear_typing_indicator, state_override), timeout_override, TIMER_STOPPABLE)
|
||||
|
||||
/*!
|
||||
* Removes typing indicator.
|
||||
* @param state_override Sets the state that we will remove. Defaults to src.get_typing_indicator_icon_state()
|
||||
*/
|
||||
/mob/proc/clear_typing_indicator(state_override = get_typing_indicator_icon_state())
|
||||
deltimer(typing_indicator_timerid)
|
||||
cut_overlay(get_indicator_overlay(state_override))
|
||||
|
||||
/// Default typing indicator
|
||||
/obj/effect/overlay/typing_indicator
|
||||
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
icon = 'icons/mob/talk.dmi'
|
||||
icon_state = "default_typing"
|
||||
appearance_flags = RESET_COLOR | TILE_BOUND | PIXEL_SCALE
|
||||
layer = LARGE_MOB_LAYER
|
||||
Reference in New Issue
Block a user