Merge pull request #14685 from Arturlang/fake_blood
Reworks blood regeneration into something a bit more tame
This commit is contained in:
@@ -39,29 +39,35 @@
|
||||
return
|
||||
|
||||
if(bodytemperature >= TCRYO && !(HAS_TRAIT(src, TRAIT_HUSK))) //cryosleep or husked people do not pump the blood.
|
||||
|
||||
//Blood regeneration if there is some space
|
||||
if(blood_volume < BLOOD_VOLUME_NORMAL && !HAS_TRAIT(src, TRAIT_NOHUNGER))
|
||||
if(integrating_blood > 0)
|
||||
var/blood_integrated = max(integrating_blood - 1, 0)
|
||||
var/blood_diff = integrating_blood - blood_integrated
|
||||
integrating_blood = blood_integrated
|
||||
if(blood_volume < BLOOD_VOLUME_MAXIMUM)
|
||||
blood_volume += blood_diff
|
||||
if(blood_volume < BLOOD_VOLUME_NORMAL)
|
||||
var/nutrition_ratio = 0
|
||||
switch(nutrition)
|
||||
if(0 to NUTRITION_LEVEL_STARVING)
|
||||
nutrition_ratio = 0.2
|
||||
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
|
||||
nutrition_ratio = 0.4
|
||||
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
|
||||
nutrition_ratio = 0.6
|
||||
if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
|
||||
nutrition_ratio = 0.8
|
||||
else
|
||||
nutrition_ratio = 1
|
||||
if(satiety > 80)
|
||||
nutrition_ratio *= 1.25
|
||||
adjust_nutrition(-nutrition_ratio * HUNGER_FACTOR)
|
||||
blood_volume = min(BLOOD_VOLUME_NORMAL, blood_volume + 0.5 * nutrition_ratio)
|
||||
if(!HAS_TRAIT(src, TRAIT_NOHUNGER))
|
||||
switch(nutrition)
|
||||
if(0 to NUTRITION_LEVEL_STARVING)
|
||||
nutrition_ratio = 0.2
|
||||
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
|
||||
nutrition_ratio = 0.4
|
||||
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
|
||||
nutrition_ratio = 0.6
|
||||
if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
|
||||
nutrition_ratio = 0.8
|
||||
else
|
||||
nutrition_ratio = 1
|
||||
if(satiety > 80)
|
||||
nutrition_ratio *= 1.25
|
||||
adjust_nutrition(-nutrition_ratio * HUNGER_FACTOR)
|
||||
blood_volume = min(BLOOD_VOLUME_NORMAL, blood_volume + 0.5 * nutrition_ratio)
|
||||
|
||||
//Effects of bloodloss
|
||||
var/word = pick("dizzy","woozy","faint")
|
||||
switch(blood_volume)
|
||||
var/blood_effect_volume = blood_volume + integrating_blood
|
||||
switch(blood_effect_volume)
|
||||
if(BLOOD_VOLUME_MAXIMUM to BLOOD_VOLUME_EXCESS)
|
||||
if(prob(10))
|
||||
to_chat(src, "<span class='warning'>You feel terribly bloated.</span>")
|
||||
@@ -94,14 +100,22 @@
|
||||
bleed(temp_bleed)
|
||||
|
||||
//Makes a blood drop, leaking amt units of blood from the mob
|
||||
/mob/living/carbon/proc/bleed(amt)
|
||||
if(blood_volume)
|
||||
/mob/living/carbon/proc/bleed(amt, force)
|
||||
var/bled = FALSE //Have we bled amnt?
|
||||
if(blood_volume > amt || force && blood_volume)
|
||||
blood_volume = max(blood_volume - amt, 0)
|
||||
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)
|
||||
bled = TRUE
|
||||
if(integrating_blood > amt || force && integrating_blood)
|
||||
integrating_blood = max(integrating_blood - amt, 0)
|
||||
bled = TRUE
|
||||
if(!bled && !force) //If we are already cycling back through, don't do this again
|
||||
bleed(amt, TRUE) //we cycle back through to try to bleed SOMETHING, not neccesarily the required amount
|
||||
return
|
||||
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, TRUE)
|
||||
|
||||
/mob/living/carbon/human/bleed(amt)
|
||||
amt *= physiology.bleed_mod
|
||||
@@ -114,6 +128,7 @@
|
||||
|
||||
/mob/living/proc/restore_blood()
|
||||
blood_volume = initial(blood_volume)
|
||||
integrating_blood = 0
|
||||
|
||||
/mob/living/carbon/restore_blood()
|
||||
blood_volume = (BLOOD_VOLUME_NORMAL * blood_ratio)
|
||||
@@ -368,10 +383,17 @@
|
||||
return
|
||||
blood_ratio = 1
|
||||
|
||||
/mob/living/proc/AdjustBloodVol(var/value)
|
||||
/mob/living/proc/AdjustBloodVol(value)
|
||||
if(blood_ratio == value)
|
||||
return
|
||||
blood_ratio = value
|
||||
if(ishuman(src))
|
||||
var/mob/living/carbon/human/H = src
|
||||
H.handle_blood()
|
||||
|
||||
/mob/living/proc/adjust_integration_blood(value, remove_actual_blood, force)
|
||||
if(integrating_blood + value < 0 && remove_actual_blood)
|
||||
blood_volume += value + integrating_blood
|
||||
blood_volume = max(blood_volume, 0)
|
||||
integrating_blood += value
|
||||
integrating_blood = clamp(integrating_blood, 0, force ? INFINITY : (BLOOD_VOLUME_MAXIMUM - (integrating_blood + blood_volume)))
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
owner.adjustOxyLoss(-heal_amt)
|
||||
owner.adjustCloneLoss(-heal_amt)
|
||||
if(owner.blood_volume && (owner.blood_volume < BLOOD_VOLUME_NORMAL))
|
||||
owner.blood_volume += 5
|
||||
owner.adjust_integration_blood(5)
|
||||
else
|
||||
owner.adjustPlasma(plasma_rate * 0.1)
|
||||
|
||||
|
||||
@@ -1273,3 +1273,6 @@
|
||||
var/mob/living/carbon/C = usr
|
||||
if(I.can_give())
|
||||
C.give(src)
|
||||
|
||||
/mob/living/carbon/proc/functional_blood()
|
||||
return blood_volume + integrating_blood
|
||||
|
||||
@@ -825,6 +825,7 @@
|
||||
dna.remove_mutation(HM.name)
|
||||
if(blood_volume < (BLOOD_VOLUME_NORMAL*blood_ratio))
|
||||
blood_volume = (BLOOD_VOLUME_NORMAL*blood_ratio)
|
||||
integrating_blood = 0
|
||||
..()
|
||||
|
||||
/mob/living/carbon/human/check_weakness(obj/item/weapon, mob/living/attacker)
|
||||
|
||||
@@ -182,3 +182,8 @@
|
||||
destination.underwear = underwear
|
||||
destination.undershirt = undershirt
|
||||
destination.socks = socks
|
||||
|
||||
/mob/living/carbon/human/adjust_integration_blood(value, force)
|
||||
if(NOBLOOD in dna.species.species_traits) //Can't lose blood if your species doesn't have any
|
||||
return
|
||||
. = ..()
|
||||
|
||||
@@ -1365,7 +1365,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
|
||||
|
||||
/datum/species/proc/handle_chemicals(datum/reagent/chem, mob/living/carbon/human/H)
|
||||
if(chem.type == exotic_blood && !istype(exotic_blood, /datum/reagent/blood))
|
||||
H.blood_volume = min(H.blood_volume + round(chem.volume, 0.1), BLOOD_VOLUME_MAXIMUM)
|
||||
H.adjust_integration_blood(round(chem.volume, 0.1))
|
||||
H.reagents.del_reagent(chem.type)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -53,16 +53,16 @@
|
||||
exotic_blood_color = "#" + H.dna.features["mcolor"]
|
||||
|
||||
/datum/species/jelly/spec_life(mob/living/carbon/human/H)
|
||||
if(H.stat == DEAD || HAS_TRAIT(H, TRAIT_NOMARROW)) //can't farm slime jelly from a dead slime/jelly person indefinitely, and no regeneration for blooduskers
|
||||
if(H.stat == DEAD || HAS_TRAIT(H, TRAIT_NOMARROW)) //can't farm slime jelly from a dead slime/jelly person indefinitely, and no regeneration for bloodsuckers
|
||||
return
|
||||
if(!H.blood_volume)
|
||||
H.blood_volume += 5
|
||||
H.adjust_integration_blood(5)
|
||||
H.adjustBruteLoss(5)
|
||||
to_chat(H, "<span class='danger'>You feel empty!</span>")
|
||||
|
||||
if(H.blood_volume < (BLOOD_VOLUME_NORMAL * H.blood_ratio))
|
||||
if(H.nutrition >= NUTRITION_LEVEL_STARVING)
|
||||
H.blood_volume += 3
|
||||
H.adjust_integration_blood(3)
|
||||
H.nutrition -= 2.5
|
||||
if(H.blood_volume < (BLOOD_VOLUME_OKAY*H.blood_ratio))
|
||||
if(prob(5))
|
||||
@@ -82,7 +82,7 @@
|
||||
consumed_limb.drop_limb()
|
||||
to_chat(H, "<span class='userdanger'>Your [consumed_limb] is drawn back into your body, unable to maintain its shape!</span>")
|
||||
qdel(consumed_limb)
|
||||
H.blood_volume += 20
|
||||
H.adjust_integration_blood(20)
|
||||
|
||||
////////////////////////////////////////////////////////SLIMEPEOPLE///////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
if(prob(5))
|
||||
to_chat(H, "<span class='notice'>You feel very bloated!</span>")
|
||||
else if(H.nutrition >= NUTRITION_LEVEL_WELL_FED)
|
||||
H.blood_volume += 3
|
||||
H.adjust_integration_blood(3)
|
||||
H.nutrition -= 2.5
|
||||
|
||||
..()
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
var/stun_absorption = null //converted to a list of stun absorption sources this mob has when one is added
|
||||
|
||||
var/blood_volume = 0 //how much blood the mob has
|
||||
var/integrating_blood = 0 //this is the variable you want to affect if you want to give the mob blood, this will slowly turn into normal blood, preventing some cheesyness, use adjust_integration_blood() instead of modifying directly
|
||||
var/blood_ratio = 1 //How much blood the mob needs, in terms of ratio (i.e 1.2 will require BLOOD_VOLUME_NORMAL of 672) DO NOT GO ABOVE 3.55 Well, actually you can but, then they can't get enough blood.
|
||||
var/obj/effect/proc_holder/ranged_ability //Any ranged ability the mob has, as a click override
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
L.SetUnconscious(0, FALSE)
|
||||
L.adjustOxyLoss(-50)// do CPR first
|
||||
if(L.blood_volume <= 500) //bandage them up and give em some blood if they're bleeding
|
||||
L.blood_volume += 30
|
||||
L.adjust_integration_blood(30)
|
||||
L.bleedsuppress = 0
|
||||
if(L.getBruteLoss() >= 50)// first, did we beat them into crit? if so, heal that
|
||||
var/healing = min(L.getBruteLoss(), 120)
|
||||
|
||||
Reference in New Issue
Block a user