diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 2d3ceb728c..99bfa7a91d 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -39,56 +39,57 @@ return if(bodytemperature >= TCRYO && !(HAS_TRAIT(src, TRAIT_HUSK))) //cryosleep or husked people do not pump the blood. - 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 - 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) + if(dna.species.handle_blood()) // if this returns TRUE, then the species is not handling blood itself and we can control everything + 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 + 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 - if(!HAS_TRAIT(src, TRAIT_ROBOTIC_ORGANISM)) //Synths are immune to direct consequences of bloodloss, instead suffering penalties to heat exchange. - var/word = pick("dizzy","woozy","faint") - 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, "You feel terribly bloated.") - if(BLOOD_VOLUME_OKAY to BLOOD_VOLUME_SAFE) - if(prob(5)) - to_chat(src, "You feel [word].") - adjustOxyLoss(round((BLOOD_VOLUME_NORMAL - blood_volume) * 0.01, 1)) - if(BLOOD_VOLUME_BAD to BLOOD_VOLUME_OKAY) - adjustOxyLoss(round((BLOOD_VOLUME_NORMAL - blood_volume) * 0.02, 1)) - if(prob(5)) - blur_eyes(6) - to_chat(src, "You feel very [word].") - if(BLOOD_VOLUME_SURVIVE to BLOOD_VOLUME_BAD) - adjustOxyLoss(5) - if(prob(15)) - Unconscious(rand(20,60)) - to_chat(src, "You feel extremely [word].") - if(-INFINITY to BLOOD_VOLUME_SURVIVE) - if(!HAS_TRAIT(src, TRAIT_NODEATH)) - death() + //Effects of bloodloss + if(!HAS_TRAIT(src, TRAIT_ROBOTIC_ORGANISM)) //Synths are immune to direct consequences of bloodloss, instead suffering penalties to heat exchange. + var/word = pick("dizzy","woozy","faint") + 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, "You feel terribly bloated.") + if(BLOOD_VOLUME_OKAY to BLOOD_VOLUME_SAFE) + if(prob(5)) + to_chat(src, "You feel [word].") + adjustOxyLoss(round((BLOOD_VOLUME_NORMAL - blood_volume) * 0.01, 1)) + if(BLOOD_VOLUME_BAD to BLOOD_VOLUME_OKAY) + adjustOxyLoss(round((BLOOD_VOLUME_NORMAL - blood_volume) * 0.02, 1)) + if(prob(5)) + blur_eyes(6) + to_chat(src, "You feel very [word].") + if(BLOOD_VOLUME_SURVIVE to BLOOD_VOLUME_BAD) + adjustOxyLoss(5) + if(prob(15)) + Unconscious(rand(20,60)) + to_chat(src, "You feel extremely [word].") + if(-INFINITY to BLOOD_VOLUME_SURVIVE) + if(!HAS_TRAIT(src, TRAIT_NODEATH)) + death() var/temp_bleed = 0 //Bleeding out diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm index 1a159a56bb..85c188d2ab 100644 --- a/code/modules/mob/living/carbon/damage_procs.dm +++ b/code/modules/mob/living/carbon/damage_procs.dm @@ -90,10 +90,12 @@ /mob/living/carbon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, toxins_type = TOX_DEFAULT) if(!forced && HAS_TRAIT(src, TRAIT_TOXINLOVER) && toxins_type != TOX_SYSCORRUPT) //damage becomes healing and healing becomes damage amount = -amount + // don't allow toxinlover to push blood levels past BLOOD_VOLUME_MAXIMUM, but also don't set it back down to this if it's higher from something else + var/blood_cap = blood_volume > BLOOD_VOLUME_MAXIMUM ? blood_volume : BLOOD_VOLUME_MAXIMUM if(amount > 0) - blood_volume -= 3 * amount //5x was too much, this is punishing enough. + blood_volume = min((blood_volume - (3 * amount)), blood_cap) //5x was too much, this is punishing enough. else - blood_volume -= amount + blood_volume = min((blood_volume - amount), blood_cap) return ..() /mob/living/carbon/getStaminaLoss() diff --git a/code/modules/mob/living/carbon/human/innate_abilities/limb_regeneration.dm b/code/modules/mob/living/carbon/human/innate_abilities/limb_regeneration.dm index ce36397c91..672b6f5b7a 100644 --- a/code/modules/mob/living/carbon/human/innate_abilities/limb_regeneration.dm +++ b/code/modules/mob/living/carbon/human/innate_abilities/limb_regeneration.dm @@ -22,28 +22,24 @@ return FALSE return 0 -/datum/action/innate/ability/limb_regrowth/Activate() +/datum/action/innate/limb_regrowth/Activate() var/mob/living/carbon/human/H = owner var/list/limbs_to_heal = H.get_missing_limbs() - if(limbs_to_heal.len < 1) - to_chat(H, "You feel intact enough as it is.") + if(!length(limbs_to_heal)) + to_chat(H, span_notice("You feel intact enough as it is.")) return - to_chat(H, "You focus intently on your missing [limbs_to_heal.len >= 2 ? "limbs" : "limb"]...") - var/mode = H.get_ability_property(INNATE_ABILITY_LIMB_REGROWTH, PROPERTY_LIMB_REGROWTH_USAGE_TYPE) - switch(mode) - if(REGROWTH_USES_BLOOD) - if(H.blood_volume >= 40*limbs_to_heal.len+(BLOOD_VOLUME_OKAY*H.blood_ratio)) - H.regenerate_limbs() - H.blood_volume -= 40*limbs_to_heal.len - to_chat(H, "...and after a moment you finish reforming!") - return - else if(H.blood_volume >= 40)//We can partially heal some limbs - while(H.blood_volume >= (BLOOD_VOLUME_OKAY*H.blood_ratio)+40) - var/healed_limb = pick(limbs_to_heal) - H.regenerate_limb(healed_limb) - limbs_to_heal -= healed_limb - H.blood_volume -= 40 - to_chat(H, "...but there is not enough of you to fix everything! You must attain more mass to heal completely!") - return - to_chat(H, "...but there is not enough of you to go around! You must attain more mass to heal!") - + to_chat(H, span_notice("You focus intently on your missing [length(limbs_to_heal) >= 2 ? "limbs" : "limb"]...")) + if(H.blood_volume >= 40*length(limbs_to_heal)+BLOOD_VOLUME_OKAY) + H.regenerate_limbs() + H.blood_volume -= 40*length(limbs_to_heal) + to_chat(H, span_notice("...and after a moment you finish reforming!")) + return + else if(H.blood_volume >= 40)//We can partially heal some limbs + while(H.blood_volume >= BLOOD_VOLUME_OKAY+40) + var/healed_limb = pick(limbs_to_heal) + H.regenerate_limb(healed_limb) + limbs_to_heal -= healed_limb + H.blood_volume -= 40 + to_chat(H, span_warning("...but there is not enough of you to fix everything! You must attain more mass to heal completely!")) + return + to_chat(H, span_warning("...but there is not enough of you to go around! You must attain more mass to heal!")) diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 3a5d35a115..af49998afe 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -2452,6 +2452,13 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) return TRUE return FALSE +//////////////// +//Blood Stuff/// +//////////////// +// true = handle blood normally, false = do not (and then handle blood in this proc instead please!!) +/datum/species/proc/handle_blood() + return TRUE + //////////////// //Tail Wagging// //////////////// diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm index 13c9aaa8f1..4712fe4475 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -55,38 +55,46 @@ //update blood color to body color 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 bloodsuckers - return - if(!H.blood_volume) - H.adjust_integration_blood(5) - H.adjustBruteLoss(5) - to_chat(H, "You feel empty!") +/datum/species/jelly/handle_blood(mob/living/carbon/human/H, delta_time, times_fired) + if(H.stat == DEAD) //can't farm slime jelly from a dead slime/jelly person indefinitely + return TRUE // we dont handle blood when dead - if(H.blood_volume < (BLOOD_VOLUME_NORMAL * H.blood_ratio)) + if(H.blood_volume <= 0) + H.blood_volume += 2.5 * delta_time + H.adjustBruteLoss(2.5 * delta_time) + to_chat(H, span_danger("You feel empty!")) + + if(H.blood_volume < BLOOD_VOLUME_NORMAL) if(H.nutrition >= NUTRITION_LEVEL_STARVING) - H.adjust_integration_blood(3) - H.nutrition -= 2.5 - if(H.blood_volume < (BLOOD_VOLUME_OKAY*H.blood_ratio)) - if(prob(5)) - to_chat(H, "You feel drained!") - if(H.blood_volume < (BLOOD_VOLUME_BAD*H.blood_ratio)) + H.blood_volume += 1.5 * delta_time + H.adjust_nutrition(-1.25 * delta_time) + + if(H.blood_volume < BLOOD_VOLUME_OKAY) + if(DT_PROB(2.5, delta_time)) + to_chat(H, span_danger("You feel drained!")) + + if(H.blood_volume < BLOOD_VOLUME_BAD) Cannibalize_Body(H) - ..() + + var/datum/action/innate/ability/regrowth = H.ability_actions[INNATE_ABILITY_LIMB_REGROWTH] + if(regrowth) + regrowth.UpdateButtonIcon() + + return FALSE // to let living/handle_blood know that the species is handling blood instead /datum/species/jelly/proc/Cannibalize_Body(mob/living/carbon/human/H) var/list/limbs_to_consume = list(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_L_LEG) - H.get_missing_limbs() var/obj/item/bodypart/consumed_limb - if(!limbs_to_consume.len) + if(!length(limbs_to_consume)) H.losebreath++ return if(H.get_num_legs(FALSE)) //Legs go before arms limbs_to_consume -= list(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM) consumed_limb = H.get_bodypart(pick(limbs_to_consume)) consumed_limb.drop_limb() - to_chat(H, "Your [consumed_limb] is drawn back into your body, unable to maintain its shape!") + to_chat(H, span_userdanger("Your [consumed_limb] is drawn back into your body, unable to maintain its shape!")) qdel(consumed_limb) - H.adjust_integration_blood(20) + H.blood_volume += 20 ////////////////////////////////////////////////////////SLIMEPEOPLE///////////////////////////////////////////////////////////////////