Fixes Typing Indicator (#4773)

* Fixes text indicator. Works on getting the chat bar to work.

* Getting the text bar to show the typing indicator proved to be impossible.

Seeing as it was cut out 3 years ago for being absolutely broke, I snipped it out of the code.

* Makes the indicator work better
This commit is contained in:
Cameron653
2018-02-10 19:16:17 -05:00
committed by Anewbe
parent 252b2ffa1c
commit e128afbd17
4 changed files with 44 additions and 38 deletions

View File

@@ -251,6 +251,25 @@ Please contact me on #coderbus IRC. ~Carn x
list_huds = hud_list.Copy()
list_huds += backplane // Required to mask HUDs in context menus: http://www.byond.com/forum/?post=2336679
//TYPING INDICATOR CODE.
if(client && !stat) //They have a client & aren't dead/KO'd? Continue on!
if(typing_indicator && hud_typing) //They already have the indicator and are still typing
overlays += typing_indicator //This might not be needed? It works, so I'm leaving it.
list_huds += typing_indicator
typing_indicator.invisibility = invisibility
else if(!typing_indicator && hud_typing) //Are they in their body, NOT dead, have hud_typing, do NOT have a typing indicator. and have it enabled?
typing_indicator = new
typing_indicator.icon = 'icons/mob/talk.dmi'
typing_indicator.icon_state = "[speech_bubble_appearance()]_typing"
overlays += typing_indicator
list_huds += typing_indicator
else if(typing_indicator && !hud_typing) //Did they stop typing?
overlays -= typing_indicator
typing = 0
hud_typing = 0
if(update_icons)
update_icons()

View File

@@ -144,7 +144,6 @@
/mob/proc/Life()
// if(organStructure)
// organStructure.ProcessOrgans()
//handle_typing_indicator() //You said the typing indicator would be fine. The test determined that was a lie.
return
#define UNBUCKLED 0

View File

@@ -218,3 +218,7 @@
var/seedarkness = 1 //Determines mob's ability to see shadows. 1 = Normal vision, 0 = darkvision
var/get_rig_stats = 0 //Moved from computer.dm
var/hud_typing = 0 //Typing indicator stuff.
var/typing //Simple mobs use this variable.
var/obj/effect/decal/typing_indicator

View File

@@ -1,13 +1,4 @@
#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
mob/var/obj/effect/decal/typing_indicator
/mob/proc/set_typing_indicator(var/state)
/mob/proc/set_typing_indicator(var/state) //Leaving this here for mobs.
if(!typing_indicator)
typing_indicator = new
@@ -33,11 +24,17 @@ mob/var/obj/effect/decal/typing_indicator
set name = ".Say"
set hidden = 1
set_typing_indicator(1)
hud_typing = 1
if(!ishuman(src)) //If they're a mob, use the old code.
set_typing_indicator(1)
if(is_preference_enabled(/datum/client_preference/show_typing_indicator))
hud_typing = 1
update_icons_huds()
var/message = input("","say (text)") as text
hud_typing = 0
set_typing_indicator(0)
if(is_preference_enabled(/datum/client_preference/show_typing_indicator))
hud_typing = 0
update_icons_huds()
if(!ishuman(src)) //If they're a mob, use the old code.
set_typing_indicator(0)
if(message)
say_verb(message)
@@ -45,29 +42,16 @@ mob/var/obj/effect/decal/typing_indicator
set name = ".Me"
set hidden = 1
set_typing_indicator(1)
hud_typing = 1
if(!ishuman(src)) //If they're a mob, use the old code.
set_typing_indicator(1)
if(is_preference_enabled(/datum/client_preference/show_typing_indicator))
hud_typing = 1
update_icons_huds()
var/message = input("","me (text)") as text
hud_typing = 0
set_typing_indicator(0)
if(is_preference_enabled(/datum/client_preference/show_typing_indicator))
hud_typing = 0
update_icons_huds()
if(!ishuman(src)) //If they're a mob, use the old code.
set_typing_indicator(0)
if(message)
me_verb(message)
/mob/proc/handle_typing_indicator()
if(is_preference_enabled(/datum/client_preference/show_typing_indicator) && !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)