From d268c1d6d0d63ee19eb407870d22e5ee992f446c Mon Sep 17 00:00:00 2001 From: LittleBigKid2000 Date: Sun, 17 Jul 2016 21:43:51 -0400 Subject: [PATCH] Stethoscope fixes and additions (#5015) * Stethoscope fixes and additions Now with less :snowflake:. At least, the species :snowflake: kind. - Stethoscopes now check for a heart and lungs. If the target doesn't have either, the user won't hear anything. Sure, this means the user will still hear a pulse if the target just has lungs and vice versa, but you'll probably be dead or have microbattery or something if you don't have both. - Using the stethoscope on yourself will display a message that uses 'your' instead of 'his' or 'her'. - Using a stethoscope on someone will tell the user if the target is having a heart attack ("hear an irregular pulse and respiration") - The messages displayed will properly use 'the'. ("[user] places the stethoscope" instead of "[user] places stethoscope") I don't know why I'm bothering with this, no one uses stethoscopes for a good reason. * (Hopefully) fixes the same message for lungs but no heart. Also reduces the oxyloss threshold thing. I probably did this very wrong. * Tully got salty because I stole his PR, so we collaborated * Rewrites the code to be less shit, probably --- .../clothing/under/accessories/accessory.dm | 68 +++++++++++-------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/code/modules/clothing/under/accessories/accessory.dm b/code/modules/clothing/under/accessories/accessory.dm index a8e44f2c363..b285624ffe0 100644 --- a/code/modules/clothing/under/accessories/accessory.dm +++ b/code/modules/clothing/under/accessories/accessory.dm @@ -103,35 +103,45 @@ /obj/item/clothing/accessory/stethoscope/attack(mob/living/carbon/human/M, mob/living/user) if(ishuman(M) && isliving(user)) - if(user.a_intent == I_HELP) - var/body_part = parse_zone(user.zone_sel.selecting) - if(body_part) - var/their = "their" - switch(M.gender) - if(MALE) their = "his" - if(FEMALE) their = "her" - - var/sound = "pulse" - var/sound_strength - - if(M.stat == DEAD || (M.status_flags&FAKEDEATH)) - sound_strength = "cannot hear" - sound = "anything" - else - sound_strength = "hear a weak" - switch(body_part) - if("chest") - if(M.oxyloss < 50) - sound_strength = "hear a healthy" - sound = "pulse and respiration" - if("eyes","mouth") - sound_strength = "cannot hear" - sound = "anything" - else - sound_strength = "hear a weak" - - user.visible_message("[user] places [src] against [M]'s [body_part] and listens attentively.", "You place [src] against [their] [body_part]. You [sound_strength] [sound].") - return + if(user == M) + user.visible_message("[user] places \the [src] against \his chest and listens attentively.", "You place \the [src] against your chest...") + else + user.visible_message("[user] places \the [src] against [M]'s chest and listens attentively.", "You place \the [src] against [M]'s chest...") + var/obj/item/organ/internal/H = M.get_int_organ(/obj/item/organ/internal/heart) + var/obj/item/organ/internal/L = M.get_int_organ(/obj/item/organ/internal/lungs) + if((H && M.pulse) || (L && !(NO_BREATH in M.mutations) && !(M.species.flags & NO_BREATH))) + var/color = "notice" + if(H) + var/heart_sound + switch(H.damage) + if(0 to 1) + heart_sound = "healthy" + if(1 to 25) + heart_sound = "offbeat" + if(25 to 50) + heart_sound = "uneven" + color = "warning" + if(50 to INFINITY) + heart_sound = "weak, unhealthy" + color = "warning" + to_chat(user, "You hear \an [heart_sound] pulse.") + if(L) + var/lung_sound + switch(L.damage) + if(0 to 1) + lung_sound = "healthy respiration" + if(1 to 25) + lung_sound = "labored respiration" + if(25 to 50) + lung_sound = "pained respiration" + color = "warning" + if(50 to INFINITY) + lung_sound = "gurgling" + color = "warning" + to_chat(user, "You hear [lung_sound].") + else + to_chat(user, "You don't hear anything.") + return return ..(M,user)