Stethoscope fixes and additions (#5015)

* Stethoscope fixes and additions

Now with less ❄️. At least, the species ❄️ 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
This commit is contained in:
LittleBigKid2000
2016-07-17 21:43:51 -04:00
committed by Fox McCloud
parent 6b0fa79aba
commit d268c1d6d0
@@ -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, "<span class='[color]'>You hear \an [heart_sound] pulse.</span>")
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, "<span class='[color]'>You hear [lung_sound].</span>")
else
to_chat(user, "<span class='warning'>You don't hear anything.</span>")
return
return ..(M,user)