From a0eac7b352a23145bd8fa407a7a2dc646dfb538a Mon Sep 17 00:00:00 2001 From: Giacomand Date: Mon, 6 Jan 2014 21:41:14 +0000 Subject: [PATCH] While in critical you can whisper your final breath, it will result in you immediately dying afterwards, like in the movies! How much you can say is dependent on how far away you are from death, the closer the less you can say. --- .../mob/living/carbon/human/human_helpers.dm | 3 ++ .../mob/living/carbon/human/whisper.dm | 45 ++++++++++++------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_helpers.dm b/code/modules/mob/living/carbon/human/human_helpers.dm index f721c364c9d..c5a0dc572e4 100644 --- a/code/modules/mob/living/carbon/human/human_helpers.dm +++ b/code/modules/mob/living/carbon/human/human_helpers.dm @@ -114,3 +114,6 @@ /mob/living/carbon/human/IsAdvancedToolUser() return 1//Humans can use guns and such + +/mob/living/carbon/human/proc/InCritical() + return (health <= config.health_threshold_crit && stat == UNCONSCIOUS) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/whisper.dm b/code/modules/mob/living/carbon/human/whisper.dm index d5ec65900b0..213894ad509 100644 --- a/code/modules/mob/living/carbon/human/whisper.dm +++ b/code/modules/mob/living/carbon/human/whisper.dm @@ -1,4 +1,3 @@ -//Lallander was here /mob/living/carbon/human/whisper(message as text) if(!IsVocal()) @@ -24,16 +23,12 @@ return - if (src.stat == 2) + if (src.stat == DEAD) return src.say_dead(message) - if (src.stat) - return - var/alt_name = "" - if (istype(src, /mob/living/carbon/human) && src.name != GetVoice()) - var/mob/living/carbon/human/H = src - alt_name = " (as [H.get_id_name("Unknown")])" + if (src.name != GetVoice()) + alt_name = " (as [get_id_name("Unknown")])" // Mute disability if (src.sdisabilities & MUTE) return @@ -41,6 +36,17 @@ if (istype(src.wear_mask, /obj/item/clothing/mask/muzzle)) return + var/whispers = "whispers" + + // If whispering your last words, limit the whisper based on how close you are to death. + var/critical = InCritical() + if(critical) + var/health_diff = round(-config.health_threshold_dead + health) + // If we cut our message short, abruptly end it with a-.. + var/message_len = length(message) + message = copytext(message, 1, health_diff) + "[message_len > health_diff ? "-.." : "..."]" + whispers = "whispers in his final breath" + var/italics = 1 var/message_range = 1 @@ -57,7 +63,8 @@ var/list/listening = hearers(message_range, src) listening -= src - listening += src + if(!critical) + listening += src var/list/eavesdropping = hearers(2, src) eavesdropping -= src eavesdropping -= listening @@ -79,9 +86,9 @@ for (var/mob/M in watching) if (M.say_understands(src)) - rendered = "[src.name] whispers something." + rendered = "[src.name] [whispers] something." else - rendered = "[src.voice_name] whispers something." + rendered = "[src.voice_name] [whispers] something." M.show_message(rendered, 2) if (length(heard_a)) @@ -90,7 +97,7 @@ if (italics) message_a = "[message_a]" //This appears copied from carbon/living say.dm so the istype check for mob is probably not needed. Appending for src is also not needed as the game will check that automatically. - rendered = "[GetVoice()][alt_name] whispers, \"[message_a]\"" + rendered = "[GetVoice()][alt_name] [whispers], \"[message_a]\"" for (var/mob/M in heard_a) M.show_message(rendered, 2) @@ -106,7 +113,7 @@ if (italics) message_b = "[message_b]" - rendered = "[src.voice_name] whispers, \"[message_b]\"" + rendered = "[src.voice_name] [whispers], \"[message_b]\"" for (var/mob/M in heard_b) M.show_message(rendered, 2) @@ -115,18 +122,24 @@ if (M.say_understands(src)) var/message_c message_c = stars(message) - rendered = "[GetVoice()][alt_name] whispers, \"[message_c]\"" + rendered = "[GetVoice()][alt_name] [whispers], \"[message_c]\"" M.show_message(rendered, 2) else - rendered = "[src.voice_name] whispers something." + rendered = "[src.voice_name] [whispers] something." M.show_message(rendered, 2) if (italics) message = "[message]" - rendered = "[GetVoice()][alt_name] whispers, \"[message]\"" + rendered = "[GetVoice()][alt_name] [whispers], \"[message]\"" for (var/mob/M in dead_mob_list) if (!(M.client)) continue if (M.stat > 1 && !(M in heard_a)) M.show_message(rendered, 2) + + // We whispered our final breath, now we die and show the message you have sent + // since it might have been cut off and it would be annoying not being able to know. + if(critical) + src << rendered + death()