From aeb603cb406e29500fcf77c327edf5135cb4c3cf Mon Sep 17 00:00:00 2001 From: bgobandit Date: Tue, 15 Jan 2019 17:12:29 -0500 Subject: [PATCH] Clicking the health doll lets you examine yourself for injuries (#42357) --- code/_onclick/hud/screen_objects.dm | 5 + .../mob/living/carbon/human/human_defense.dm | 189 +++++++++--------- 2 files changed, 101 insertions(+), 93 deletions(-) diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index d70d6b8b281..1825be1e24c 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -645,6 +645,11 @@ name = "health doll" screen_loc = ui_healthdoll +/obj/screen/healthdoll/Click() + if (ishuman(usr)) + var/mob/living/carbon/human/H = usr + H.check_self_for_injuries() + /obj/screen/mood name = "mood" icon_state = "mood5" diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 851da8e17db..aaa757cf6e4 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -649,100 +649,8 @@ return if(src == M) - visible_message("[src] examines [p_them()]self.", \ - "You check yourself for injuries.") + check_self_for_injuries() - var/list/missing = list(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) - for(var/X in bodyparts) - var/obj/item/bodypart/LB = X - missing -= LB.body_zone - if(LB.is_pseudopart) //don't show injury text for fake bodyparts; ie chainsaw arms or synthetic armblades - continue - var/limb_max_damage = LB.max_damage - var/status = "" - var/brutedamage = LB.brute_dam - var/burndamage = LB.burn_dam - if(hallucination) - if(prob(30)) - brutedamage += rand(30,40) - if(prob(30)) - burndamage += rand(30,40) - - if(has_trait(TRAIT_SELF_AWARE)) - status = "[brutedamage] brute damage and [burndamage] burn damage" - if(!brutedamage && !burndamage) - status = "no damage" - - else - if(brutedamage > 0) - status = LB.light_brute_msg - if(brutedamage > (limb_max_damage*0.4)) - status = LB.medium_brute_msg - if(brutedamage > (limb_max_damage*0.8)) - status = LB.heavy_brute_msg - if(brutedamage > 0 && burndamage > 0) - status += " and " - - if(burndamage > (limb_max_damage*0.8)) - status += LB.heavy_burn_msg - else if(burndamage > (limb_max_damage*0.2)) - status += LB.medium_burn_msg - else if(burndamage > 0) - status += LB.light_burn_msg - - if(status == "") - status = "OK" - var/no_damage - if(status == "OK" || status == "no damage") - no_damage = TRUE - to_chat(src, "\t Your [LB.name] [has_trait(TRAIT_SELF_AWARE) ? "has" : "is"] [status].") - - for(var/obj/item/I in LB.embedded_objects) - to_chat(src, "\t There is \a [I] embedded in your [LB.name]!") - - for(var/t in missing) - to_chat(src, "Your [parse_zone(t)] is missing!") - - if(bleed_rate) - to_chat(src, "You are bleeding!") - if(getStaminaLoss()) - if(getStaminaLoss() > 30) - to_chat(src, "You're completely exhausted.") - else - to_chat(src, "You feel fatigued.") - if(has_trait(TRAIT_SELF_AWARE)) - if(toxloss) - if(toxloss > 10) - to_chat(src, "You feel sick.") - else if(toxloss > 20) - to_chat(src, "You feel nauseated.") - else if(toxloss > 40) - to_chat(src, "You feel very unwell!") - if(oxyloss) - if(oxyloss > 10) - to_chat(src, "You feel lightheaded.") - else if(oxyloss > 20) - to_chat(src, "Your thinking is clouded and distant.") - else if(oxyloss > 30) - to_chat(src, "You're choking!") - - if(!has_trait(TRAIT_NOHUNGER)) - switch(nutrition) - if(NUTRITION_LEVEL_FULL to INFINITY) - to_chat(src, "You're completely stuffed!") - if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL) - to_chat(src, "You're well fed!") - if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED) - to_chat(src, "You're not hungry.") - if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED) - to_chat(src, "You could use a bite to eat.") - if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY) - to_chat(src, "You feel quite hungry.") - if(0 to NUTRITION_LEVEL_STARVING) - to_chat(src, "You're starving!") - - if(roundstart_quirks.len) - to_chat(src, "You have these quirks: [get_trait_string()].") else if(wear_suit) wear_suit.add_fingerprint(M) @@ -751,6 +659,101 @@ ..() +/mob/living/carbon/human/proc/check_self_for_injuries() + visible_message("[src] examines [p_them()]self.", \ + "You check yourself for injuries.") + + var/list/missing = list(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) + for(var/X in bodyparts) + var/obj/item/bodypart/LB = X + missing -= LB.body_zone + if(LB.is_pseudopart) //don't show injury text for fake bodyparts; ie chainsaw arms or synthetic armblades + continue + var/limb_max_damage = LB.max_damage + var/status = "" + var/brutedamage = LB.brute_dam + var/burndamage = LB.burn_dam + if(hallucination) + if(prob(30)) + brutedamage += rand(30,40) + if(prob(30)) + burndamage += rand(30,40) + + if(has_trait(TRAIT_SELF_AWARE)) + status = "[brutedamage] brute damage and [burndamage] burn damage" + if(!brutedamage && !burndamage) + status = "no damage" + + else + if(brutedamage > 0) + status = LB.light_brute_msg + if(brutedamage > (limb_max_damage*0.4)) + status = LB.medium_brute_msg + if(brutedamage > (limb_max_damage*0.8)) + status = LB.heavy_brute_msg + if(brutedamage > 0 && burndamage > 0) + status += " and " + + if(burndamage > (limb_max_damage*0.8)) + status += LB.heavy_burn_msg + else if(burndamage > (limb_max_damage*0.2)) + status += LB.medium_burn_msg + else if(burndamage > 0) + status += LB.light_burn_msg + + if(status == "") + status = "OK" + var/no_damage + if(status == "OK" || status == "no damage") + no_damage = TRUE + to_chat(src, "\t Your [LB.name] [has_trait(TRAIT_SELF_AWARE) ? "has" : "is"] [status].") + + for(var/obj/item/I in LB.embedded_objects) + to_chat(src, "\t There is \a [I] embedded in your [LB.name]!") + + for(var/t in missing) + to_chat(src, "Your [parse_zone(t)] is missing!") + + if(bleed_rate) + to_chat(src, "You are bleeding!") + if(getStaminaLoss()) + if(getStaminaLoss() > 30) + to_chat(src, "You're completely exhausted.") + else + to_chat(src, "You feel fatigued.") + if(has_trait(TRAIT_SELF_AWARE)) + if(toxloss) + if(toxloss > 10) + to_chat(src, "You feel sick.") + else if(toxloss > 20) + to_chat(src, "You feel nauseated.") + else if(toxloss > 40) + to_chat(src, "You feel very unwell!") + if(oxyloss) + if(oxyloss > 10) + to_chat(src, "You feel lightheaded.") + else if(oxyloss > 20) + to_chat(src, "Your thinking is clouded and distant.") + else if(oxyloss > 30) + to_chat(src, "You're choking!") + + if(!has_trait(TRAIT_NOHUNGER)) + switch(nutrition) + if(NUTRITION_LEVEL_FULL to INFINITY) + to_chat(src, "You're completely stuffed!") + if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL) + to_chat(src, "You're well fed!") + if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED) + to_chat(src, "You're not hungry.") + if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED) + to_chat(src, "You could use a bite to eat.") + if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY) + to_chat(src, "You feel quite hungry.") + if(0 to NUTRITION_LEVEL_STARVING) + to_chat(src, "You're starving!") + + if(roundstart_quirks.len) + to_chat(src, "You have these quirks: [get_trait_string()].") /mob/living/carbon/human/damage_clothes(damage_amount, damage_type = BRUTE, damage_flag = 0, def_zone) if(damage_type != BRUTE && damage_type != BURN)