Skip to content

Commit

Permalink
Clicking the health doll lets you examine yourself for injuries (tgst…
Browse files Browse the repository at this point in the history
  • Loading branch information
bgobandit authored and ExcessiveUseOfCobblestone committed Jan 15, 2019
1 parent 9cf3c5b commit aeb603c
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 93 deletions.
5 changes: 5 additions & 0 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
189 changes: 96 additions & 93 deletions code/modules/mob/living/carbon/human/human_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -649,100 +649,8 @@
return

if(src == M)
visible_message("[src] examines [p_them()]self.", \
"<span class='notice'>You check yourself for injuries.</span>")
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 <span class='[no_damage ? "notice" : "warning"]'>Your [LB.name] [has_trait(TRAIT_SELF_AWARE) ? "has" : "is"] [status].</span>")

for(var/obj/item/I in LB.embedded_objects)
to_chat(src, "\t <a href='?src=[REF(src)];embedded_object=[REF(I)];embedded_limb=[REF(LB)]' class='warning'>There is \a [I] embedded in your [LB.name]!</a>")

for(var/t in missing)
to_chat(src, "<span class='boldannounce'>Your [parse_zone(t)] is missing!</span>")

if(bleed_rate)
to_chat(src, "<span class='danger'>You are bleeding!</span>")
if(getStaminaLoss())
if(getStaminaLoss() > 30)
to_chat(src, "<span class='info'>You're completely exhausted.</span>")
else
to_chat(src, "<span class='info'>You feel fatigued.</span>")
if(has_trait(TRAIT_SELF_AWARE))
if(toxloss)
if(toxloss > 10)
to_chat(src, "<span class='danger'>You feel sick.</span>")
else if(toxloss > 20)
to_chat(src, "<span class='danger'>You feel nauseated.</span>")
else if(toxloss > 40)
to_chat(src, "<span class='danger'>You feel very unwell!</span>")
if(oxyloss)
if(oxyloss > 10)
to_chat(src, "<span class='danger'>You feel lightheaded.</span>")
else if(oxyloss > 20)
to_chat(src, "<span class='danger'>Your thinking is clouded and distant.</span>")
else if(oxyloss > 30)
to_chat(src, "<span class='danger'>You're choking!</span>")

if(!has_trait(TRAIT_NOHUNGER))
switch(nutrition)
if(NUTRITION_LEVEL_FULL to INFINITY)
to_chat(src, "<span class='info'>You're completely stuffed!</span>")
if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL)
to_chat(src, "<span class='info'>You're well fed!</span>")
if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
to_chat(src, "<span class='info'>You're not hungry.</span>")
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
to_chat(src, "<span class='info'>You could use a bite to eat.</span>")
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
to_chat(src, "<span class='info'>You feel quite hungry.</span>")
if(0 to NUTRITION_LEVEL_STARVING)
to_chat(src, "<span class='danger'>You're starving!</span>")

if(roundstart_quirks.len)
to_chat(src, "<span class='notice'>You have these quirks: [get_trait_string()].</span>")
else
if(wear_suit)
wear_suit.add_fingerprint(M)
Expand All @@ -751,6 +659,101 @@

..()

/mob/living/carbon/human/proc/check_self_for_injuries()
visible_message("[src] examines [p_them()]self.", \
"<span class='notice'>You check yourself for injuries.</span>")

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 <span class='[no_damage ? "notice" : "warning"]'>Your [LB.name] [has_trait(TRAIT_SELF_AWARE) ? "has" : "is"] [status].</span>")

for(var/obj/item/I in LB.embedded_objects)
to_chat(src, "\t <a href='?src=[REF(src)];embedded_object=[REF(I)];embedded_limb=[REF(LB)]' class='warning'>There is \a [I] embedded in your [LB.name]!</a>")

for(var/t in missing)
to_chat(src, "<span class='boldannounce'>Your [parse_zone(t)] is missing!</span>")

if(bleed_rate)
to_chat(src, "<span class='danger'>You are bleeding!</span>")
if(getStaminaLoss())
if(getStaminaLoss() > 30)
to_chat(src, "<span class='info'>You're completely exhausted.</span>")
else
to_chat(src, "<span class='info'>You feel fatigued.</span>")
if(has_trait(TRAIT_SELF_AWARE))
if(toxloss)
if(toxloss > 10)
to_chat(src, "<span class='danger'>You feel sick.</span>")
else if(toxloss > 20)
to_chat(src, "<span class='danger'>You feel nauseated.</span>")
else if(toxloss > 40)
to_chat(src, "<span class='danger'>You feel very unwell!</span>")
if(oxyloss)
if(oxyloss > 10)
to_chat(src, "<span class='danger'>You feel lightheaded.</span>")
else if(oxyloss > 20)
to_chat(src, "<span class='danger'>Your thinking is clouded and distant.</span>")
else if(oxyloss > 30)
to_chat(src, "<span class='danger'>You're choking!</span>")

if(!has_trait(TRAIT_NOHUNGER))
switch(nutrition)
if(NUTRITION_LEVEL_FULL to INFINITY)
to_chat(src, "<span class='info'>You're completely stuffed!</span>")
if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL)
to_chat(src, "<span class='info'>You're well fed!</span>")
if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
to_chat(src, "<span class='info'>You're not hungry.</span>")
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
to_chat(src, "<span class='info'>You could use a bite to eat.</span>")
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
to_chat(src, "<span class='info'>You feel quite hungry.</span>")
if(0 to NUTRITION_LEVEL_STARVING)
to_chat(src, "<span class='danger'>You're starving!</span>")

if(roundstart_quirks.len)
to_chat(src, "<span class='notice'>You have these quirks: [get_trait_string()].</span>")

/mob/living/carbon/human/damage_clothes(damage_amount, damage_type = BRUTE, damage_flag = 0, def_zone)
if(damage_type != BRUTE && damage_type != BURN)
Expand Down

0 comments on commit aeb603c

Please sign in to comment.