diff --git a/code/game/objects/items/devices/defibrillator.dm b/code/game/objects/items/devices/defibrillator.dm index 0596ae9d14b8..30d0467a9b76 100644 --- a/code/game/objects/items/devices/defibrillator.dm +++ b/code/game/objects/items/devices/defibrillator.dm @@ -11,7 +11,10 @@ w_class = SIZE_MEDIUM var/blocked_by_suit = TRUE - var/heart_damage_to_deal = 5 + /// Min damage defib deals to victims' heart + var/min_heart_damage_dealt = 3 + /// Max damage defib deals to victims' heart + var/max_heart_damage_dealt = 5 var/ready = 0 var/damage_heal_threshold = 12 //This is the maximum non-oxy damage the defibrillator will heal to get a patient above -100, in all categories var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread @@ -191,8 +194,11 @@ shock_cooldown = world.time + 10 //1 second cooldown before you can shock again var/datum/internal_organ/heart/heart = H.internal_organs_by_name["heart"] + /// Has the defib already caused the chance of heart damage, to not potentially double up later + var/heart_already_damaged = FALSE if(heart && prob(25)) - heart.take_damage(heart_damage_to_deal, TRUE) //Allow the defibrillator to possibly worsen heart damage. Still rare enough to just be the "clone damage" of the defib + heart.take_damage(rand(min_heart_damage_dealt, max_heart_damage_dealt), TRUE) // Make death and revival leave lasting consequences + heart_already_damaged = TRUE if(!H.is_revivable()) playsound(get_turf(src), 'sound/items/defib_failed.ogg', 25, 0) @@ -230,6 +236,9 @@ user.track_life_saved(user.job) user.life_revives_total++ H.handle_revive() + if(heart && !heart_already_damaged) + heart.take_damage(rand(min_heart_damage_dealt, max_heart_damage_dealt), TRUE) // Make death and revival leave lasting consequences + to_chat(H, SPAN_NOTICE("You suddenly feel a spark and your consciousness returns, dragging you back to the mortal plane.")) if(H.client?.prefs.toggles_flashing & FLASH_CORPSEREVIVE) window_flash(H.client) @@ -239,13 +248,14 @@ /obj/item/device/defibrillator/compact_adv name = "advanced compact defibrillator" - desc = "An advanced compact defibrillator that trades capacity for strong immediate power. Ignores armor and heals strongly and quickly, at the cost of very low charge." + desc = "An advanced compact defibrillator that trades capacity for strong immediate power. Ignores armor and heals strongly and quickly, at the cost of very low charge. It does not damage the heart." icon = 'icons/obj/items/experimental_tools.dmi' icon_state = "compact_defib" item_state = "defib" w_class = SIZE_MEDIUM blocked_by_suit = FALSE - heart_damage_to_deal = 0 + min_heart_damage_dealt = 0 + max_heart_damage_dealt = 0 damage_heal_threshold = 40 charge_cost = 198 diff --git a/code/modules/cm_tech/implements/medical_czsp.dm b/code/modules/cm_tech/implements/medical_czsp.dm index e0b00ebf5afd..3eed2fc9f619 100644 --- a/code/modules/cm_tech/implements/medical_czsp.dm +++ b/code/modules/cm_tech/implements/medical_czsp.dm @@ -83,10 +83,11 @@ /obj/item/device/defibrillator/upgraded name = "upgraded emergency defibrillator" icon_state = "adv_defib" - desc = "An advanced rechargeable defibrillator using induction to deliver shocks through metallic objects, such as armor, and does so with much greater efficiency than the standard variant." + desc = "An advanced rechargeable defibrillator using induction to deliver shocks through metallic objects, such as armor, and does so with much greater efficiency than the standard variant, not damaging the heart." blocked_by_suit = FALSE - heart_damage_to_deal = 0 + min_heart_damage_dealt = 0 + max_heart_damage_dealt = 0 damage_heal_threshold = 35 /obj/item/ammo_magazine/internal/pillgun diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 61848eda251c..72a95074e574 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -29,27 +29,35 @@ b_volume = 0 else if(chem_effect_flags & CHEM_EFFECT_ORGAN_STASIS) b_volume *= 1 - else if(heart.damage > 1 && heart.damage < heart.min_bruised_damage) - b_volume *= 0.8 - else if(heart.damage >= heart.min_bruised_damage && heart.damage < heart.min_broken_damage) - b_volume *= 0.6 - else if(heart.damage >= heart.min_broken_damage && heart.damage < INFINITY) - b_volume *= 0.3 + 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 += max(additional_oxyloss, 0) + + //Bloodloss effects on nutrition + if(nutrition >= 300) + nutrition -= 10 + else if(nutrition >= 200) + nutrition -= 3 + 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(oxyloss < 20) - oxyloss += 3 if(BLOOD_VOLUME_BAD to BLOOD_VOLUME_OKAY) if(eye_blurry < 50) AdjustEyeBlur(6) - if(oxyloss < 50) - oxyloss += 10 - oxyloss += 2 + oxyloss += 3 if(prob(15)) apply_effect(rand(1,3), PARALYZE) var/word = pick("dizzy","woozy","faint") @@ -57,7 +65,7 @@ if(BLOOD_VOLUME_SURVIVE to BLOOD_VOLUME_BAD) if(eye_blurry < 50) AdjustEyeBlur(6) - oxyloss += 5 + oxyloss += 8 toxloss += 3 if(prob(15)) apply_effect(rand(1,3), PARALYZE) @@ -66,13 +74,6 @@ if(0 to BLOOD_VOLUME_SURVIVE) death(create_cause_data("blood loss")) - // Without enough blood you slowly go hungry. - if(blood_volume < BLOOD_VOLUME_SAFE) - if(nutrition >= 300) - nutrition -= 10 - else if(nutrition >= 200) - nutrition -= 3 - // Xeno blood regeneration /mob/living/carbon/xenomorph/handle_blood() if(stat != DEAD) //Only living xenos regenerate blood