mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
@@ -913,6 +913,7 @@
|
||||
#include "code\modules\mob\mob_transformation_simple.dm"
|
||||
#include "code\modules\mob\say.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\dead\death.dm"
|
||||
#include "code\modules\mob\dead\observer\logout.dm"
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
/mob/proc/Life()
|
||||
// if(organStructure)
|
||||
// organStructure.ProcessOrgans()
|
||||
handle_typing_indicator()
|
||||
return
|
||||
|
||||
|
||||
|
||||
@@ -219,4 +219,4 @@
|
||||
|
||||
var/turf/listed_turf = null //the current turf being examined in the stat panel
|
||||
|
||||
var/list/active_genes=list()
|
||||
var/list/active_genes=list()
|
||||
@@ -12,6 +12,8 @@
|
||||
if(say_disabled) //This is here to try to identify lag problems
|
||||
usr << "\red Speech is currently admin-disabled."
|
||||
return
|
||||
|
||||
set_typing_indicator(0)
|
||||
usr.say(message)
|
||||
|
||||
/mob/verb/me_verb(message as text)
|
||||
@@ -24,6 +26,7 @@
|
||||
|
||||
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
|
||||
|
||||
set_typing_indicator(0)
|
||||
if(use_me)
|
||||
usr.emote("me",usr.emote_type,message)
|
||||
else
|
||||
|
||||
76
code/modules/mob/typing_indicator.dm
Normal file
76
code/modules/mob/typing_indicator.dm
Normal file
@@ -0,0 +1,76 @@
|
||||
#define TYPING_INDICATOR_LIFETIME 30 * 10 //grace period after which typing indicator disappears regardless of text in chatbar
|
||||
|
||||
mob/var/hud_typing = 0 //set when typing in an input window instead of chatline
|
||||
mob/var/typing
|
||||
mob/var/last_typed
|
||||
mob/var/last_typed_time
|
||||
|
||||
var/global/image/typing_indicator
|
||||
|
||||
/mob/proc/set_typing_indicator(var/state)
|
||||
if(client)
|
||||
if(!(client.prefs.toggles & SHOW_TYPING))
|
||||
if(!typing_indicator)
|
||||
typing_indicator = image('icons/mob/talk.dmi',null,"typing")
|
||||
if(state)
|
||||
if(!typing)
|
||||
overlays += typing_indicator
|
||||
typing = 1
|
||||
else
|
||||
if(typing)
|
||||
overlays -= typing_indicator
|
||||
typing = 0
|
||||
return state
|
||||
|
||||
/mob/verb/say_wrapper()
|
||||
set name = ".Say"
|
||||
set hidden = 1
|
||||
|
||||
set_typing_indicator(1)
|
||||
hud_typing = 1
|
||||
var/message = input("","say (text)") as text
|
||||
hud_typing = 0
|
||||
set_typing_indicator(0)
|
||||
if(message)
|
||||
say_verb(message)
|
||||
|
||||
/mob/verb/me_wrapper()
|
||||
set name = ".Me"
|
||||
set hidden = 1
|
||||
|
||||
set_typing_indicator(1)
|
||||
hud_typing = 1
|
||||
var/message = input("","me (text)") as text
|
||||
hud_typing = 0
|
||||
set_typing_indicator(0)
|
||||
if(message)
|
||||
me_verb(message)
|
||||
|
||||
/mob/proc/handle_typing_indicator()
|
||||
if(client)
|
||||
if(!(client.prefs.toggles & SHOW_TYPING) && !hud_typing)
|
||||
var/temp = winget(client, "input", "text")
|
||||
|
||||
if (temp != last_typed)
|
||||
last_typed = temp
|
||||
last_typed_time = world.time
|
||||
|
||||
if (world.time > last_typed_time + TYPING_INDICATOR_LIFETIME)
|
||||
set_typing_indicator(0)
|
||||
return
|
||||
if(length(temp) > 5 && findtext(temp, "Say \"", 1, 7))
|
||||
set_typing_indicator(1)
|
||||
else if(length(temp) > 3 && findtext(temp, "Me ", 1, 5))
|
||||
set_typing_indicator(1)
|
||||
|
||||
else
|
||||
set_typing_indicator(0)
|
||||
|
||||
/client/verb/typing_indicator()
|
||||
set name = "Show/Hide Typing Indicator"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles showing an indicator when you are typing emote or say message."
|
||||
prefs.toggles ^= SHOW_TYPING
|
||||
prefs.save_preferences()
|
||||
src << "You will [(prefs.toggles & CHAT_OOC) ? "no longer" : "now"] display typing indicator."
|
||||
feedback_add_details("admin_verb","TID") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
@@ -649,6 +649,7 @@ var/list/liftable_structures = list(\
|
||||
#define CHAT_DEBUGLOGS 2048
|
||||
#define CHAT_LOOC 4096
|
||||
#define CHAT_GHOSTRADIO 8192
|
||||
#define SHOW_TYPING 16384
|
||||
|
||||
|
||||
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_ATTACKLOGS|CHAT_LOOC)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -149,11 +149,11 @@ macro "macro"
|
||||
is-disabled = false
|
||||
elem
|
||||
name = "F3"
|
||||
command = "say"
|
||||
command = ".say"
|
||||
is-disabled = false
|
||||
elem
|
||||
name = "F4"
|
||||
command = "me"
|
||||
command = ".me"
|
||||
is-disabled = false
|
||||
elem
|
||||
name = "F5"
|
||||
@@ -403,11 +403,11 @@ macro "hotkeymode"
|
||||
is-disabled = false
|
||||
elem
|
||||
name = "F3"
|
||||
command = "say"
|
||||
command = ".say"
|
||||
is-disabled = false
|
||||
elem
|
||||
name = "F4"
|
||||
command = "me"
|
||||
command = ".me"
|
||||
is-disabled = false
|
||||
elem
|
||||
name = "F5"
|
||||
|
||||
Reference in New Issue
Block a user