Adds typing indicator.

It's toggleable as client preference.
Displays dots(codersprite) near the mob when he starts typing a message.
Detects chatline me and say via checking contents.
Detects shortcut input me an say via hacky wrapper that's called now instead of direct say/me verbs.
This commit is contained in:
Chinsky
2014-08-29 04:10:37 +04:00
parent a893baf8be
commit 12364f0cd2
8 changed files with 68 additions and 4 deletions

View File

@@ -911,6 +911,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"

View File

@@ -73,6 +73,7 @@
/mob/proc/Life()
// if(organStructure)
// organStructure.ProcessOrgans()
handle_typing_indicator()
return

View File

@@ -220,3 +220,4 @@
var/turf/listed_turf = null //the current turf being examined in the stat panel
var/list/active_genes=list()
var/hud_typing = 0 //set when typing in an input window instead of chatline

View File

@@ -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

View File

@@ -0,0 +1,57 @@
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_indicator in overlays))
overlays += typing_indicator
else
overlays -= typing_indicator
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(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) ? "now" : "no longer"] 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!

View File

@@ -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

View File

@@ -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_wrapper"
is-disabled = false
elem
name = "F4"
command = "me"
command = "me_wrapper"
is-disabled = false
elem
name = "F5"