Merge pull request #12015 from kevinz000/typing_indicators
Typing Indicators (v2)
This commit is contained in:
@@ -80,8 +80,9 @@
|
||||
#define SPACEVINE_LAYER 4.8
|
||||
#define SPACEVINE_MOB_LAYER 4.9
|
||||
//#define FLY_LAYER 5 //For easy recordkeeping; this is a byond define
|
||||
#define GASFIRE_LAYER 5.05
|
||||
#define RIPPLE_LAYER 5.1
|
||||
#define ABOVE_FLY_LAYER 5.1
|
||||
#define GASFIRE_LAYER 5.2
|
||||
#define RIPPLE_LAYER 5.3
|
||||
|
||||
#define GHOST_LAYER 6
|
||||
#define LOW_LANDMARK_LAYER 9
|
||||
|
||||
@@ -290,6 +290,8 @@
|
||||
|
||||
#define HUMAN_FIRE_STACK_ICON_NUM 3
|
||||
|
||||
#define TYPING_INDICATOR_TIMEOUT 5 MINUTES
|
||||
|
||||
#define GRAB_PIXEL_SHIFT_PASSIVE 6
|
||||
#define GRAB_PIXEL_SHIFT_AGGRESSIVE 12
|
||||
#define GRAB_PIXEL_SHIFT_NECK 16
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
if(SEND_SIGNAL(src, COMSIG_MOB_CLICKON, A, params) & COMSIG_MOB_CANCEL_CLICKON)
|
||||
return
|
||||
|
||||
|
||||
var/list/modifiers = params2list(params)
|
||||
if(modifiers["shift"] && modifiers["middle"])
|
||||
ShiftMiddleClickOn(A)
|
||||
|
||||
@@ -34,9 +34,11 @@ SUBSYSTEM_DEF(input)
|
||||
"O" = "ooc",
|
||||
"Ctrl+O" = "looc",
|
||||
"T" = "say",
|
||||
"Ctrl+T" = "whisper",
|
||||
"Ctrl+T" = "say_indicator",
|
||||
"Y" = "whisper",
|
||||
"M" = "me",
|
||||
"Ctrl+M" = "subtle",
|
||||
"Ctrl+M" = "me_indicator",
|
||||
"5" = "subtle",
|
||||
"Back" = "\".winset \\\"input.text=\\\"\\\"\\\"\"", // This makes it so backspace can remove default inputs
|
||||
"Any" = "\"KeyDown \[\[*\]\]\"",
|
||||
"Any+UP" = "\"KeyUp \[\[*\]\]\"",
|
||||
@@ -51,7 +53,9 @@ SUBSYSTEM_DEF(input)
|
||||
"O" = "ooc",
|
||||
"L" = "looc",
|
||||
"T" = "say",
|
||||
"Ctrl+T" = "say_indicator",
|
||||
"M" = "me",
|
||||
"Ctrl+M" = "me_indicator",
|
||||
"Back" = "\".winset \\\"input.text=\\\"\\\"\\\"\"", // This makes it so backspace can remove default inputs
|
||||
"Any" = "\"KeyDown \[\[*\]\]\"",
|
||||
"Any+UP" = "\"KeyUp \[\[*\]\]\"",
|
||||
|
||||
@@ -23,5 +23,4 @@
|
||||
lay_down()
|
||||
return
|
||||
|
||||
|
||||
return ..()
|
||||
@@ -104,6 +104,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/icon_limbs //Overrides the icon used for the limbs of this species. Mainly for downstream, and also because hardcoded icons disgust me. Implemented and maintained as a favor in return for a downstream's implementation of synths.
|
||||
|
||||
/// Our default override for typing indicator state
|
||||
var/typing_indicator_state
|
||||
|
||||
///////////
|
||||
// PROCS //
|
||||
///////////
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
/mob/living/carbon/human/get_typing_indicator_icon_state()
|
||||
return dna?.species?.typing_indicator_state || ..()
|
||||
@@ -5,6 +5,8 @@
|
||||
hud_possible = list(HEALTH_HUD,STATUS_HUD,ANTAG_HUD,NANITE_HUD,DIAG_NANITE_FULL_HUD,RAD_HUD)
|
||||
pressure_resistance = 10
|
||||
|
||||
typing_indicator_enabled = TRUE
|
||||
|
||||
var/resize = 1 //Badminnery resize
|
||||
var/lastattacker = null
|
||||
var/lastattackerckey = null
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/mob/living/Moved()
|
||||
. = ..()
|
||||
update_turf_movespeed(loc)
|
||||
//Hide typing indicator if we move.
|
||||
clear_typing_indicator()
|
||||
if(is_shifted)
|
||||
is_shifted = FALSE
|
||||
pixel_x = get_standard_pixel_x_offset(lying)
|
||||
|
||||
@@ -130,3 +130,16 @@
|
||||
var/siliconaccesstoggle = FALSE
|
||||
|
||||
var/voluntary_ghosted = FALSE //whether or not they voluntarily ghosted.
|
||||
|
||||
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
|
||||
/// Current state of our typing indicator. Used for cut overlay, DO NOT RUNTIME ASSIGN OTHER THAN FROM SHOW/CLEAR. Used to absolutely ensure we do not get stuck overlays.
|
||||
var/typing_indicator_current
|
||||
|
||||
+47
-16
@@ -1,12 +1,53 @@
|
||||
//Speech verbs.
|
||||
/mob/verb/say_verb(message as text)
|
||||
set name = "Say"
|
||||
// the _keybind verbs uses "as text" versus "as text|null" to force a popup when pressed by a keybind.
|
||||
/mob/verb/say_typing_indicator()
|
||||
set name = "say_indicator"
|
||||
set hidden = TRUE
|
||||
set category = "IC"
|
||||
display_typing_indicator()
|
||||
var/message = input(usr, "", "say") as text|null
|
||||
// If they don't type anything just drop the message.
|
||||
clear_typing_indicator() // clear it immediately!
|
||||
if(!length(message))
|
||||
return
|
||||
return say_verb(message)
|
||||
|
||||
/mob/verb/say_verb(message as text)
|
||||
set name = "say"
|
||||
set category = "IC"
|
||||
if(!length(message))
|
||||
return
|
||||
if(GLOB.say_disabled) //This is here to try to identify lag problems
|
||||
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
|
||||
return
|
||||
if(message)
|
||||
say(message)
|
||||
clear_typing_indicator() // clear it immediately!
|
||||
say(message)
|
||||
|
||||
/mob/verb/me_typing_indicator()
|
||||
set name = "me_indicator"
|
||||
set hidden = TRUE
|
||||
set category = "IC"
|
||||
display_typing_indicator()
|
||||
var/message = input(usr, "", "me") as message|null
|
||||
// If they don't type anything just drop the message.
|
||||
clear_typing_indicator() // clear it immediately!
|
||||
if(!length(message))
|
||||
return
|
||||
return me_verb(message)
|
||||
|
||||
/mob/verb/me_verb(message as message)
|
||||
set name = "me"
|
||||
set category = "IC"
|
||||
if(!length(message))
|
||||
return
|
||||
if(GLOB.say_disabled) //This is here to try to identify lag problems
|
||||
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
|
||||
return
|
||||
|
||||
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))
|
||||
clear_typing_indicator() // clear it immediately!
|
||||
|
||||
usr.emote("me",1,message,TRUE)
|
||||
|
||||
/mob/say_mod(input, message_mode)
|
||||
var/customsayverb = findtext(input, "*")
|
||||
@@ -19,6 +60,8 @@
|
||||
/mob/verb/whisper_verb(message as text)
|
||||
set name = "Whisper"
|
||||
set category = "IC"
|
||||
if(!length(message))
|
||||
return
|
||||
if(GLOB.say_disabled) //This is here to try to identify lag problems
|
||||
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
|
||||
return
|
||||
@@ -27,18 +70,6 @@
|
||||
/mob/proc/whisper(message, datum/language/language=null)
|
||||
say(message, language) //only living mobs actually whisper, everything else just talks
|
||||
|
||||
/mob/verb/me_verb(message as message)
|
||||
set name = "Me"
|
||||
set category = "IC"
|
||||
|
||||
if(GLOB.say_disabled) //This is here to try to identify lag problems
|
||||
to_chat(usr, "<span class='danger'>Speech is currently admin-disabled.</span>")
|
||||
return
|
||||
|
||||
message = trim(copytext_char(sanitize(message), 1, MAX_MESSAGE_LEN))
|
||||
|
||||
usr.emote("me",1,message,TRUE)
|
||||
|
||||
/mob/proc/say_dead(var/message)
|
||||
var/name = real_name
|
||||
var/alt_name = ""
|
||||
|
||||
@@ -23,7 +23,6 @@ proc/get_top_level_mob(var/mob/S)
|
||||
message = null
|
||||
mob_type_blacklist_typecache = list(/mob/living/brain)
|
||||
|
||||
|
||||
/datum/emote/living/subtle/proc/check_invalid(mob/user, input)
|
||||
if(stop_bad_mime.Find(input, 1, 1))
|
||||
to_chat(user, "<span class='danger'>Invalid emote.</span>")
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/// 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) || typing_indicator_current)
|
||||
return
|
||||
typing_indicator_current = state_override
|
||||
add_overlay(state_override)
|
||||
typing_indicator_timerid = addtimer(CALLBACK(src, .proc/clear_typing_indicator), timeout_override, TIMER_STOPPABLE)
|
||||
|
||||
/**
|
||||
* Removes typing indicator.
|
||||
*/
|
||||
/mob/proc/clear_typing_indicator()
|
||||
cut_overlay(typing_indicator_current)
|
||||
typing_indicator_current = null
|
||||
if(typing_indicator_timerid)
|
||||
deltimer(typing_indicator_timerid)
|
||||
typing_indicator_timerid = null
|
||||
|
||||
/// Default typing indicator
|
||||
/obj/effect/overlay/typing_indicator
|
||||
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
icon = 'icons/mob/talk.dmi'
|
||||
icon_state = "normal_typing"
|
||||
appearance_flags = RESET_COLOR | TILE_BOUND | PIXEL_SCALE
|
||||
layer = ABOVE_FLY_LAYER
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 8.5 KiB |
@@ -2243,6 +2243,7 @@
|
||||
#include "code\modules\mob\say_vr.dm"
|
||||
#include "code\modules\mob\status_procs.dm"
|
||||
#include "code\modules\mob\transform_procs.dm"
|
||||
#include "code\modules\mob\typing_indicator.dm"
|
||||
#include "code\modules\mob\update_icons.dm"
|
||||
#include "code\modules\mob\camera\camera.dm"
|
||||
#include "code\modules\mob\dead\dead.dm"
|
||||
@@ -2374,6 +2375,7 @@
|
||||
#include "code\modules\mob\living\carbon\human\say.dm"
|
||||
#include "code\modules\mob\living\carbon\human\species.dm"
|
||||
#include "code\modules\mob\living\carbon\human\status_procs.dm"
|
||||
#include "code\modules\mob\living\carbon\human\typing_indicator.dm"
|
||||
#include "code\modules\mob\living\carbon\human\update_icons.dm"
|
||||
#include "code\modules\mob\living\carbon\human\species_types\abductors.dm"
|
||||
#include "code\modules\mob\living\carbon\human\species_types\android.dm"
|
||||
@@ -3320,6 +3322,7 @@
|
||||
#include "interface\interface.dm"
|
||||
#include "interface\menu.dm"
|
||||
#include "interface\stylesheet.dm"
|
||||
#include "interface\skin.dmf"
|
||||
#include "modular_citadel\code\__HELPERS\list2list.dm"
|
||||
#include "modular_citadel\code\__HELPERS\lists.dm"
|
||||
#include "modular_citadel\code\__HELPERS\mobs.dm"
|
||||
|
||||
Reference in New Issue
Block a user