From 170f3cd8759141ba4ec245975895531c66b37e0d Mon Sep 17 00:00:00 2001 From: QuickLode <63271983+QuickLode@users.noreply.github.com> Date: Wed, 22 Nov 2023 15:49:09 -0800 Subject: [PATCH] Synthetic internal powercell (#4559) # About the pull request This PR should tackle two things: 1. Synths shouldn't lose blood 2. Synths shouldn't feel woozy (RP) revives #3589 from ghostsheet # Explain why it's good for the game Synthetics should not be feeling woozy. They also shouldn't be going blind from bloodloss. # Testing Photographs and Procedure
Screenshots & Videos Put screenshots and videos here with an empty line between the screenshots and the `
` tags. https://cdn.discordapp.com/attachments/490668342357786645/1157856898834497536/image.png?ex=651a21c4&is=6518d044&hm=813abcc8be5fd02367499e24651c97b7f840d8bcbc557364c534f1c0a61f25f5& https://cdn.discordapp.com/attachments/490668342357786645/1157856899132305529/image.png?ex=651a21c4&is=6518d044&hm=d9fb14dcaa5eb9fa8ad1280636a5f8f188a72e0e5045b892fc29192046acd139&
# Changelog :cl: add: Damage to Synthetic's internal causes debuffs, eventual powercell failure.(death) fix: Synthetic's should no longer lose blood. code: moves blood proc to human.dm from blood.dm with above changes. /:cl: --------- Co-authored-by: harryob --- code/modules/mob/living/blood.dm | 78 +----------------- .../mob/living/carbon/human/species/human.dm | 82 +++++++++++++++++++ 2 files changed, 84 insertions(+), 76 deletions(-) diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index ab3ce823c68e..dea179e6ad48 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -2,80 +2,6 @@ BLOOD SYSTEM */ -/mob/living/proc/handle_blood() - return - -// Takes care blood loss and regeneration -/mob/living/carbon/human/handle_blood() - if(NO_BLOOD in species.flags) - return - - if(stat != DEAD && bodytemperature >= 170) //Dead or cryosleep people do not pump the blood. - //Blood regeneration if there is some space - if(blood_volume < max_blood && nutrition >= 1) - blood_volume += 0.1 // regenerate blood VERY slowly - nutrition -= 0.25 - else if(blood_volume > max_blood) - blood_volume -= 0.1 // The reverse in case we've gotten too much blood in our body - if(blood_volume > limit_blood) - blood_volume = limit_blood // This should never happen, but lets make sure - - var/b_volume = blood_volume - - // Damaged heart virtually reduces the blood volume, as the blood isn't - // being pumped properly anymore. - if(species && species.has_organ["heart"]) - var/datum/internal_organ/heart/heart = internal_organs_by_name["heart"] - if(!heart) - b_volume = 0 - else if(chem_effect_flags & CHEM_EFFECT_ORGAN_STASIS) - b_volume *= 1 - else if(heart.damage >= heart.organ_status >= ORGAN_BRUISED) - b_volume *= Clamp(100 - (2 * heart.damage), 30, 100) / 100 - - //Effects of bloodloss - if(b_volume <= BLOOD_VOLUME_SAFE) - /// The blood volume turned into a %, with BLOOD_VOLUME_NORMAL being 100% - var/blood_percentage = b_volume / (BLOOD_VOLUME_NORMAL / 100) - /// How much oxyloss will there be from the next time blood processes - var/additional_oxyloss = (100 - blood_percentage) / 5 - /// The limit of the oxyloss gained, ignoring oxyloss from the switch statement - var/maximum_oxyloss = Clamp((100 - blood_percentage) / 2, oxyloss, 100) - if(oxyloss < maximum_oxyloss) - oxyloss += round(max(additional_oxyloss, 0)) - - switch(b_volume) - if(BLOOD_VOLUME_OKAY to BLOOD_VOLUME_SAFE) - if(prob(1)) - var/word = pick("dizzy","woozy","faint") - to_chat(src, SPAN_DANGER("You feel [word].")) - if(BLOOD_VOLUME_BAD to BLOOD_VOLUME_OKAY) - if(eye_blurry < 50) - AdjustEyeBlur(6) - oxyloss += 3 - if(prob(15)) - apply_effect(rand(1,3), PARALYZE) - var/word = pick("dizzy","woozy","faint") - to_chat(src, SPAN_DANGER("You feel very [word].")) - if(BLOOD_VOLUME_SURVIVE to BLOOD_VOLUME_BAD) - if(eye_blurry < 50) - AdjustEyeBlur(6) - oxyloss += 8 - toxloss += 3 - if(prob(15)) - apply_effect(rand(1,3), PARALYZE) - var/word = pick("dizzy","woozy","faint") - to_chat(src, SPAN_DANGER("You feel extremely [word].")) - if(0 to BLOOD_VOLUME_SURVIVE) - death(create_cause_data("blood loss")) - -// Xeno blood regeneration -/mob/living/carbon/xenomorph/handle_blood() - if(stat != DEAD) //Only living xenos regenerate blood - //Blood regeneration if there is some space - if(blood_volume < max_blood) - blood_volume = min(blood_volume + 1, max_blood) - //Makes a blood drop, leaking amt units of blood from the mob /mob/living/carbon/proc/drip(amt) if(!blood_volume) @@ -91,7 +17,7 @@ /mob/living/carbon/human/drip(amt) if(in_stasis) // stasis now stops bloodloss return - if(NO_BLOOD in species.flags) + if((species.flags & NO_BLOOD) && !(species.flags & IS_SYNTHETIC)) return ..() @@ -272,7 +198,7 @@ return "xenoblood" /mob/living/carbon/human/get_blood_id() - if((NO_BLOOD in species.flags)) + if(species.flags & NO_BLOOD) return if(special_blood) return special_blood diff --git a/code/modules/mob/living/carbon/human/species/human.dm b/code/modules/mob/living/carbon/human/species/human.dm index 6a59e97af867..add78365a350 100644 --- a/code/modules/mob/living/carbon/human/species/human.dm +++ b/code/modules/mob/living/carbon/human/species/human.dm @@ -1,3 +1,85 @@ +// handles all blood related problems for humans and synthetics, moved from blood.dm +/mob/living/proc/handle_blood() + return + +// Takes care blood loss and regeneration +/mob/living/carbon/human/handle_blood() + if((species.flags & NO_BLOOD) && !(species.flags & IS_SYNTHETIC)) + return + + if(stat != DEAD && bodytemperature >= 170) //Dead or cryosleep people do not pump the blood. + //Blood regeneration if there is some space + if(blood_volume < max_blood && nutrition >= 1) + blood_volume += 0.1 // regenerate blood VERY slowly + nutrition -= 0.25 + else if(blood_volume > max_blood) + blood_volume -= 0.1 // The reverse in case we've gotten too much blood in our body + if(blood_volume > limit_blood) + blood_volume = limit_blood // This should never happen, but lets make sure + + var/b_volume = blood_volume + + // Damaged heart virtually reduces the blood volume, as the blood isn't + // being pumped properly anymore. + if(species && species.has_organ["heart"]) + var/datum/internal_organ/heart/heart = internal_organs_by_name["heart"] + if(!heart) + b_volume = 0 + else if(chem_effect_flags & CHEM_EFFECT_ORGAN_STASIS) + b_volume *= 1 + else if(heart.damage >= heart.organ_status >= ORGAN_BRUISED) + b_volume *= Clamp(100 - (2 * heart.damage), 30, 100) / 100 + + //Effects of bloodloss + if(b_volume <= BLOOD_VOLUME_SAFE) + /// The blood volume turned into a %, with BLOOD_VOLUME_NORMAL being 100% + var/blood_percentage = b_volume / (BLOOD_VOLUME_NORMAL / 100) + /// How much oxyloss will there be from the next time blood processes + var/additional_oxyloss = (100 - blood_percentage) / 5 + /// The limit of the oxyloss gained, ignoring oxyloss from the switch statement + var/maximum_oxyloss = Clamp((100 - blood_percentage) / 2, oxyloss, 100) + if(oxyloss < maximum_oxyloss) + oxyloss += round(max(additional_oxyloss, 0)) + + switch(b_volume) + if(BLOOD_VOLUME_OKAY to BLOOD_VOLUME_SAFE) + if(species.flags & IS_SYNTHETIC) + if(prob(1)) + to_chat(src, SPAN_DANGER("Subdermal damage detected in critical region. Operational impact minimal. Diagnosis queued for maintenance cycle.")) + else + if(prob(1)) + var/word = pick("dizzy","woozy","faint") + to_chat(src, SPAN_DANGER("You feel [word].")) + if(BLOOD_VOLUME_BAD to BLOOD_VOLUME_OKAY) + if(species.flags & IS_SYNTHETIC) + if(prob(3)) + apply_effect(rand(1, 2), WEAKEN) + to_chat(src, SPAN_DANGER("Internal power cell fault detected.\nSeek nearest recharging station.")) + else + if(eye_blurry < 50) + AdjustEyeBlur(6) + oxyloss += 3 + if(prob(15)) + apply_effect(rand(1,3), PARALYZE) + var/word = pick("dizzy","woozy","faint") + to_chat(src, SPAN_DANGER("You feel very [word].")) + if(BLOOD_VOLUME_SURVIVE to BLOOD_VOLUME_BAD) + if(species.flags & IS_SYNTHETIC) + if(prob(5)) + apply_effect(rand(1, 2), PARALYZE) + to_chat(src, SPAN_DANGER("Critical power cell failure detected.\nSeek recharging station immediately.")) + else + if(eye_blurry < 50) + AdjustEyeBlur(6) + oxyloss += 8 + toxloss += 3 + if(prob(15)) + apply_effect(rand(1, 3), PARALYZE) + var/word = pick("dizzy", "woozy", "faint") + to_chat(src, SPAN_DANGER("You feel extremely [word].")) + if(0 to BLOOD_VOLUME_SURVIVE) + death(create_cause_data(species.flags & IS_SYNTHETIC ? "power failure" : "blood loss")) + /datum/species/human group = SPECIES_HUMAN name = "Human"