Skip to content

Commit

Permalink
Synthetic internal powercell (#4559)
Browse files Browse the repository at this point in the history
# About the pull request

<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->


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
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` 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&

</details>


# 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 <[email protected]>
  • Loading branch information
QuickLode and harryob committed Nov 22, 2023
1 parent 7947f36 commit 170f3cd
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 76 deletions.
78 changes: 2 additions & 76 deletions code/modules/mob/living/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
..()

Expand Down Expand Up @@ -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
Expand Down
82 changes: 82 additions & 0 deletions code/modules/mob/living/carbon/human/species/human.dm
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 170f3cd

Please sign in to comment.