Skip to content

Commit

Permalink
Cleans up defib code a little
Browse files Browse the repository at this point in the history
  • Loading branch information
private-tristan committed Jan 20, 2024
1 parent cb1d612 commit 64c1c57
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions code/game/objects/items/devices/defibrillator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,6 @@
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(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)
Expand Down Expand Up @@ -236,7 +231,7 @@
user.track_life_saved(user.job)
user.life_revives_total++
H.handle_revive()
if(heart && !heart_already_damaged)
if(heart)
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."))
Expand All @@ -245,6 +240,8 @@
else
user.visible_message(SPAN_WARNING("[icon2html(src, viewers(src))] \The [src] buzzes: Defibrillation failed. Vital signs are too weak, repair damage and try again.")) //Freak case
playsound(get_turf(src), 'sound/items/defib_failed.ogg', 25, 0)
if(heart && prob(25))
heart.take_damage(rand(min_heart_damage_dealt, max_heart_damage_dealt), TRUE) // Make death and revival leave lasting consequences

/obj/item/device/defibrillator/compact_adv
name = "advanced compact defibrillator"
Expand Down

0 comments on commit 64c1c57

Please sign in to comment.