Improves Bleeding Feedback + Misc Wound/Organ Decay Tweaks (+ Removes Teeth) (#56056)

This commit is contained in:
Ryll Ryll
2021-01-14 23:53:34 -08:00
committed by GitHub
parent 0736d4cfc7
commit 787bbeddbb
19 changed files with 238 additions and 86 deletions
+85 -8
View File
@@ -68,24 +68,101 @@
if(temp_bleed)
bleed(temp_bleed)
bleed_warn(temp_bleed)
//Makes a blood drop, leaking amt units of blood from the mob
/mob/living/carbon/proc/bleed(amt)
if(blood_volume)
blood_volume = max(blood_volume - amt, 0)
if (prob(sqrt(amt)*BLOOD_DRIP_RATE_MOD))
if(isturf(src.loc)) //Blood loss still happens in locker, floor stays clean
if(amt >= 10)
add_splatter_floor(src.loc)
else
add_splatter_floor(src.loc, 1)
if(!blood_volume)
return
blood_volume = max(blood_volume - amt, 0)
//Blood loss still happens in locker, floor stays clean
if(isturf(loc) && prob(sqrt(amt)*BLOOD_DRIP_RATE_MOD))
add_splatter_floor(loc, (amt >= 10))
/mob/living/carbon/human/bleed(amt)
amt *= physiology.bleed_mod
if(!(NOBLOOD in dna.species.species_traits))
..()
/// A helper to see how much blood we're losing per tick
/mob/living/carbon/proc/get_bleed_rate()
if(!blood_volume)
return
var/bleed_amt = 0
for(var/X in bodyparts)
var/obj/item/bodypart/iter_bodypart = X
bleed_amt += iter_bodypart.get_bleed_rate()
return bleed_amt
/mob/living/carbon/human/get_bleed_rate()
if((NOBLOOD in dna.species.species_traits))
return
. = ..()
. *= physiology.bleed_mod
/**
* bleed_warn() is used to for carbons with an active client to occasionally receive messages warning them about their bleeding status (if applicable)
*
* Arguments:
* * bleed_amt- When we run this from [/mob/living/carbon/human/proc/handle_blood] we already know how much blood we're losing this tick, so we can skip tallying it again with this
* * forced-
*/
/mob/living/carbon/proc/bleed_warn(bleed_amt = 0, forced = FALSE)
if(!blood_volume || !client)
return
if(!COOLDOWN_FINISHED(src, bleeding_message_cd) && !forced)
return
if(!bleed_amt) // if we weren't provided the amount of blood we lost this tick in the args
bleed_amt = get_bleed_rate()
var/bleeding_severity = ""
var/next_cooldown = BLEEDING_MESSAGE_BASE_CD
switch(bleed_amt)
if(-INFINITY to 0)
return
if(0 to 1)
bleeding_severity = "You feel light trickles of blood across your skin"
next_cooldown *= 2.5
if(1 to 3)
bleeding_severity = "You feel a small stream of blood running across your body"
next_cooldown *= 2
if(3 to 5)
bleeding_severity = "You skin feels clammy from the flow of blood leaving your body"
next_cooldown *= 1.7
if(5 to 7)
bleeding_severity = "Your body grows more and more numb as blood streams out"
next_cooldown *= 1.5
if(7 to INFINITY)
bleeding_severity = "Your heartbeat thrashes wildly trying to keep up with your bloodloss"
var/rate_of_change = ", but it's getting better." // if there's no wounds actively getting bloodier or maintaining the same flow, we must be getting better!
if(HAS_TRAIT(src, TRAIT_COAGULATING)) // if we have coagulant, we're getting better quick
rate_of_change = ", but it's clotting up quickly!"
else
// flick through our wounds to see if there are any bleeding ones getting worse or holding flow (maybe move this to handle_blood and cache it so we don't need to cycle through the wounds so much)
for(var/i in all_wounds)
var/datum/wound/iter_wound = i
if(!iter_wound.blood_flow)
continue
var/iter_wound_roc = iter_wound.get_bleed_rate_of_change()
switch(iter_wound_roc)
if(BLOOD_FLOW_INCREASING) // assume the worst, if one wound is getting bloodier, we focus on that
rate_of_change = ", <b>and it's getting worse!</b>"
break
if(BLOOD_FLOW_STEADY) // our best case now is that our bleeding isn't getting worse
rate_of_change = ", and it's holding steady."
if(BLOOD_FLOW_DECREASING) // this only matters if none of the wounds fit the above two cases, included here for completeness
continue
to_chat(src, "<span class='warning'>[bleeding_severity][rate_of_change]</span>")
COOLDOWN_START(src, bleeding_message_cd, next_cooldown)
/mob/living/carbon/human/bleed_warn(bleed_amt = 0, forced = FALSE)
if(!(NOBLOOD in dna.species.species_traits))
return ..()
/mob/living/proc/restore_blood()
blood_volume = initial(blood_volume)
+1 -1
View File
@@ -12,7 +12,7 @@
attack_verb_simple = list("attack", "slap", "whack")
///The brain's organ variables are significantly more different than the other organs, with half the decay rate for balance reasons, and twice the maxHealth
decay_factor = STANDARD_ORGAN_DECAY / 2 //30 minutes of decaying to result in a fully damaged brain, since a fast decay rate would be unfun gameplay-wise
decay_factor = STANDARD_ORGAN_DECAY * 0.5 //30 minutes of decaying to result in a fully damaged brain, since a fast decay rate would be unfun gameplay-wise
maxHealth = BRAIN_DAMAGE_DEATH
low_threshold = 45
@@ -106,3 +106,5 @@
/// Can other carbons be shoved into this one to make it fall?
var/can_be_shoved_into = FALSE
COOLDOWN_DECLARE(bleeding_message_cd)