Skip to content

Commit

Permalink
pain rebalance (#689)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kapu1178 authored Nov 22, 2023
1 parent bf3d7e6 commit 35db3b1
Show file tree
Hide file tree
Showing 13 changed files with 259 additions and 247 deletions.
9 changes: 4 additions & 5 deletions code/__DEFINES/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@
#define ui_palette_scroll_offset(north_offset) ("WEST+1:8,NORTH-[6+north_offset]:28")

//Middle right (status indicators)
#define ui_healthdoll "EAST-1:28,CENTER-2:17"
#define ui_healthdoll "EAST-1:28,CENTER-1:19"
#define ui_health "EAST-1:28,CENTER-1:19"
#define ui_internal "EAST-1:28,CENTER+1:21"
#define ui_mood "EAST-1:28,CENTER:21"
#define ui_spacesuit "EAST-1:28,CENTER-4:14"
#define ui_stamina "EAST-1:28,CENTER-3:14"
#define ui_blob_health "EAST-1:28,CENTER+1:21"
#define ui_spacesuit "EAST-1:28,CENTER-3:14"
#define ui_stamina "EAST-1:28,CENTER-2:17"

//Pop-up inventory
#define ui_shoes "WEST+1:8,SOUTH:5"
Expand Down
4 changes: 0 additions & 4 deletions code/_onclick/hud/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,6 @@
spacesuit.hud = src
infodisplay += spacesuit

healths = new /atom/movable/screen/healths()
healths.hud = src
infodisplay += healths

healthdoll = new /atom/movable/screen/healthdoll()
healthdoll.hud = src
infodisplay += healthdoll
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@
/atom/movable/screen/healths/blob
name = "blob health"
icon_state = "block"
screen_loc = ui_internal
screen_loc = ui_blob_health
mouse_opacity = MOUSE_OPACITY_TRANSPARENT

/atom/movable/screen/healths/blob/overmind
Expand All @@ -679,7 +679,7 @@
mouse_opacity = MOUSE_OPACITY_TRANSPARENT

/atom/movable/screen/healthdoll
name = "health doll"
name = "physical health"
screen_loc = ui_healthdoll

/atom/movable/screen/healthdoll/Click()
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/tackle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
if(modifiers[ALT_CLICK] || modifiers[SHIFT_CLICK] || modifiers[CTRL_CLICK] || modifiers[MIDDLE_CLICK])
return

if(!user.throw_mode || user.get_active_held_item() || user.get_active_grabs() || user.buckled || user.incapacitated())
if(!user.throw_mode || user.get_active_held_item() || length(user.get_active_grabs()) || user.buckled || user.incapacitated())
return

if(!A || !(isturf(A) || isturf(A.loc)))
Expand Down
102 changes: 55 additions & 47 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -709,53 +709,61 @@
/mob/living/carbon/human/update_health_hud()
if(!client || !hud_used)
return
if(dna.species.update_health_hud())
return
else
if(hud_used.healths)
if(..()) //not dead
switch(hal_screwyhud)
if(SCREWYHUD_CRIT)
hud_used.healths.icon_state = "health6"
if(SCREWYHUD_DEAD)
hud_used.healths.icon_state = "health7"
if(SCREWYHUD_HEALTHY)
hud_used.healths.icon_state = "health0"
if(hud_used.healthdoll)
hud_used.healthdoll.cut_overlays()
if(stat != DEAD)
hud_used.healthdoll.icon_state = "healthdoll_OVERLAY"
for(var/obj/item/bodypart/body_part as anything in bodyparts)
var/icon_num = 0
//Hallucinations
if(body_part.type in hal_screwydoll)
icon_num = hal_screwydoll[body_part.type]
hud_used.healthdoll.add_overlay(mutable_appearance('icons/hud/screen_gen.dmi', "[body_part.body_zone][icon_num]"))
continue
//Not hallucinating
var/damage = body_part.burn_dam + body_part.brute_dam
var/comparison = (body_part.max_damage/5)
if(damage)
icon_num = 1
if(damage > (comparison))
icon_num = 2
if(damage > (comparison*2))
icon_num = 3
if(damage > (comparison*3))
icon_num = 4
if(damage > (comparison*4))
icon_num = 5
if(hal_screwyhud == SCREWYHUD_HEALTHY)
icon_num = 0
if(icon_num)
hud_used.healthdoll.add_overlay(mutable_appearance('icons/hud/screen_gen.dmi', "[body_part.body_zone][icon_num]"))

for(var/t in get_missing_limbs()) //Missing limbs
hud_used.healthdoll.add_overlay(mutable_appearance('icons/hud/screen_gen.dmi', "[t]6"))
for(var/t in get_disabled_limbs()) //Disabled limbs
hud_used.healthdoll.add_overlay(mutable_appearance('icons/hud/screen_gen.dmi', "[t]7"))
else
hud_used.healthdoll.icon_state = "healthdoll_DEAD"

if(hud_used.healths) // Kapu note: We don't use this on humans due to human health being brain health. It'd be confusing.
if(..()) //not dead
switch(hal_screwyhud)
if(SCREWYHUD_CRIT)
hud_used.healths.icon_state = "health6"
if(SCREWYHUD_DEAD)
hud_used.healths.icon_state = "health7"
if(SCREWYHUD_HEALTHY)
hud_used.healths.icon_state = "health0"

if(hud_used.healthdoll)
var/list/new_overlays = list()
hud_used.healthdoll.cut_overlays()
if(stat != DEAD)
hud_used.healthdoll.icon_state = "healthdoll_OVERLAY"
for(var/obj/item/bodypart/body_part as anything in bodyparts)
var/icon_num = 0

//Hallucinations
if(body_part.type in hal_screwydoll)
icon_num = hal_screwydoll[body_part.type]
new_overlays += image('icons/hud/screen_gen.dmi', "[body_part.body_zone][icon_num]")
continue

if(hal_screwyhud == SCREWYHUD_HEALTHY)
icon_num = 0
//Not hallucinating
else
var/dam_state = min(1,((body_part.brute_dam + body_part.burn_dam) / max(1,body_part.max_damage)))
if(dam_state)
icon_num = max(1, min(Ceil(dam_state * 6), 6))

if(icon_num)
new_overlays += image('icons/hud/screen_gen.dmi', "[body_part.body_zone][icon_num]")

if(body_part.getPain() > 20)
new_overlays += image('icons/hud/screen_gen.dmi', "[body_part.body_zone]pain")

if(body_part.bodypart_disabled) //Disabled limb
new_overlays += image('icons/hud/screen_gen.dmi', "[body_part.body_zone]7")

for(var/t in get_missing_limbs()) //Missing limbs
new_overlays += image('icons/hud/screen_gen.dmi', "[t]6")

if(undergoing_cardiac_arrest())
new_overlays += image('icons/hud/screen_gen.dmi', "softcrit")

if(on_fire)
new_overlays += image('icons/hud/screen_gen.dmi', "burning")

//Add all the overlays at once, more performant!
hud_used.healthdoll.add_overlay(new_overlays)
else
hud_used.healthdoll.icon_state = "healthdoll_DEAD"

/mob/living/carbon/human/fully_heal(admin_revive = FALSE)
dna?.species.spec_fully_heal(src)
Expand Down
182 changes: 0 additions & 182 deletions code/modules/mob/living/carbon/human/human_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -707,188 +707,6 @@

return ..()

/mob/living/carbon/human/check_self_for_injuries()
if(stat >= UNCONSCIOUS)
return
var/list/combined_msg = list("<div class='examine_block'>") //PARIAH EDIT CHANGE

visible_message(span_notice("[src] examines [p_them()]self.")) //PARIAH EDIT CHANGE

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)

var/list/bodyparts = sort_list(src.bodyparts, GLOBAL_PROC_REF(cmp_bodyparts_display_order))
for(var/obj/item/bodypart/body_part as anything in bodyparts)
missing -= body_part.body_zone
if(body_part.is_pseudopart) //don't show injury text for fake bodyparts; ie chainsaw arms or synthetic armblades
continue
var/self_aware = FALSE
if(HAS_TRAIT(src, TRAIT_SELF_AWARE))
self_aware = TRUE
var/limb_max_damage = body_part.max_damage
var/status = ""
var/brutedamage = body_part.brute_dam
var/burndamage = body_part.burn_dam
if(hallucination)
if(prob(30))
brutedamage += rand(30,40)
if(prob(30))
burndamage += rand(30,40)

if(HAS_TRAIT(src, TRAIT_SELF_AWARE))
status = "[brutedamage] brute damage and [burndamage] burn damage"
if(!brutedamage && !burndamage)
status = "no damage"

else
if(body_part.type in hal_screwydoll)//Are we halucinating?
brutedamage = (hal_screwydoll[body_part.type] * 0.2)*limb_max_damage

if(brutedamage > 0)
status = body_part.light_brute_msg
if(brutedamage > (limb_max_damage*0.4))
status = body_part.medium_brute_msg
if(brutedamage > (limb_max_damage*0.8))
status = body_part.heavy_brute_msg
if(brutedamage > 0 && burndamage > 0)
status += " and "

if(burndamage > (limb_max_damage*0.8))
status += body_part.heavy_burn_msg
else if(burndamage > (limb_max_damage*0.2))
status += body_part.medium_burn_msg
else if(burndamage > 0)
status += body_part.light_burn_msg

if(status == "")
status = "OK"

var/no_damage
if(status == "OK" || status == "no damage")
no_damage = TRUE

var/isdisabled = ""
if(body_part.bodypart_disabled && !body_part.is_stump)
isdisabled = " is disabled"
if(no_damage)
isdisabled += " but otherwise"
else
isdisabled += " and"

var/broken = ""
if(body_part.check_bones() & CHECKBONES_BROKEN)
broken = " has a broken bone and"

combined_msg += "\t <span class='[no_damage ? "notice" : "warning"]'>Your [body_part.name][isdisabled][broken][self_aware ? " has " : " is "][status].</span>"

if(body_part.check_bones() & BP_BROKEN_BONES)
combined_msg += "\t [span_warning("Your [body_part.plaintext_zone] is broken!")]"

for(var/t in missing)
combined_msg += span_boldannounce("Your [parse_zone(t)] is missing!")

if(is_bleeding())
var/list/obj/item/bodypart/bleeding_limbs = list()
for(var/obj/item/bodypart/part as anything in bodyparts)
if(part.get_modified_bleed_rate())
bleeding_limbs += part

var/num_bleeds = LAZYLEN(bleeding_limbs)
var/bleed_text = "<span class='danger'>You are bleeding from your"
switch(num_bleeds)
if(1 to 2)
bleed_text += " [bleeding_limbs[1].name][num_bleeds == 2 ? " and [bleeding_limbs[2].name]" : ""]"
if(3 to INFINITY)
for(var/i in 1 to (num_bleeds - 1))
var/obj/item/bodypart/BP = bleeding_limbs[i]
bleed_text += " [BP.name],"
bleed_text += " and [bleeding_limbs[num_bleeds].name]"
bleed_text += "!</span>"
combined_msg += bleed_text

if(stamina.loss)
if(HAS_TRAIT(src, TRAIT_EXHAUSTED))
combined_msg += span_info("You're completely exhausted.")
else
combined_msg += span_info("You feel fatigued.")
if(HAS_TRAIT(src, TRAIT_SELF_AWARE))
var/toxloss = getToxLoss()
if(toxloss)
if(toxloss > 10)
combined_msg += span_danger("You feel sick.")
else if(toxloss > 20)
combined_msg += span_danger("You feel nauseated.")
else if(toxloss > 40)
combined_msg += span_danger("You feel very unwell!")
if(oxyloss)
if(oxyloss > 10)
combined_msg += span_danger("You feel lightheaded.")
else if(oxyloss > 20)
combined_msg += span_danger("Your thinking is clouded and distant.")
else if(oxyloss > 30)
combined_msg += span_danger("You're choking!")

if(!HAS_TRAIT(src, TRAIT_NOHUNGER))
switch(nutrition)
if(NUTRITION_LEVEL_FULL to INFINITY)
combined_msg += span_info("You're completely stuffed!")
if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL)
combined_msg += span_info("You're well fed!")
if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
combined_msg += span_info("You're not hungry.")
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
combined_msg += span_info("You could use a bite to eat.")
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
combined_msg += span_info("You feel quite hungry.")
if(0 to NUTRITION_LEVEL_STARVING)
combined_msg += span_danger("You're starving!")

//Compiles then shows the list of damaged organs and broken organs
var/list/broken = list()
var/list/damaged = list()
var/broken_message
var/damaged_message
var/broken_plural
var/damaged_plural
//Sets organs into their proper list
for(var/obj/item/organ/organ as anything in processing_organs)
if(organ.organ_flags & ORGAN_DEAD)
if(broken.len)
broken += ", "
broken += organ.name
else if(organ.damage > organ.low_threshold)
if(damaged.len)
damaged += ", "
damaged += organ.name
//Checks to enforce proper grammar, inserts words as necessary into the list
if(broken.len)
if(broken.len > 1)
broken.Insert(broken.len, "and ")
broken_plural = TRUE
else
var/holder = broken[1] //our one and only element
if(holder[length(holder)] == "s")
broken_plural = TRUE
//Put the items in that list into a string of text
for(var/B in broken)
broken_message += B
combined_msg += span_warning("Your [broken_message] [broken_plural ? "are" : "is"] non-functional!")
if(damaged.len)
if(damaged.len > 1)
damaged.Insert(damaged.len, "and ")
damaged_plural = TRUE
else
var/holder = damaged[1]
if(holder[length(holder)] == "s")
damaged_plural = TRUE
for(var/D in damaged)
damaged_message += D
combined_msg += span_info("Your [damaged_message] [damaged_plural ? "are" : "is"] hurt.")

if(quirks.len)
combined_msg += span_notice("You have these quirks: [get_quirk_string(FALSE, CAT_QUIRK_ALL)].")

to_chat(src, combined_msg.Join("\n"))

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

0 comments on commit 35db3b1

Please sign in to comment.