diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 339f9c1051..75228b376a 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -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() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 57947ff453..a21da32479 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -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 diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index d8044da328..1f7fb2d64d 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -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 \ No newline at end of file diff --git a/code/modules/mob/typing_indicator.dm b/code/modules/mob/typing_indicator.dm index 0ce5f390c4..bce33b7719 100644 --- a/code/modules/mob/typing_indicator.dm +++ b/code/modules/mob/typing_indicator.dm @@ -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) \ No newline at end of file