Merge pull request #15696 from timothyteakettle/fix-slimes

fixes slimes blood processing (see pr description)
This commit is contained in:
silicons
2022-07-08 14:20:40 -07:00
committed by GitHub
5 changed files with 105 additions and 91 deletions
@@ -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, "<span class='notice'>You feel intact enough as it is.</span>")
if(!length(limbs_to_heal))
to_chat(H, span_notice("You feel intact enough as it is."))
return
to_chat(H, "<span class='notice'>You focus intently on your missing [limbs_to_heal.len >= 2 ? "limbs" : "limb"]...</span>")
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, "<span class='notice'>...and after a moment you finish reforming!</span>")
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, "<span class='warning'>...but there is not enough of you to fix everything! You must attain more mass to heal completely!</span>")
return
to_chat(H, "<span class='warning'>...but there is not enough of you to go around! You must attain more mass to heal!</span>")
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!"))
@@ -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//
////////////////
@@ -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, "<span class='danger'>You feel empty!</span>")
/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, "<span class='danger'>You feel drained!</span>")
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, "<span class='userdanger'>Your [consumed_limb] is drawn back into your body, unable to maintain its shape!</span>")
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///////////////////////////////////////////////////////////////////