Skip to content

Commit

Permalink
Cleans up defib code a little (#5507)
Browse files Browse the repository at this point in the history
# About the pull request
removes the "heart_already_damaged" var from the defib file, instead
just having the defib check if it failed before applying the random
chance for heart damage
<!-- 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.
-->

# Explain why it's good for the game

![image](https://github.com/cmss13-devs/cmss13/assets/54422837/631fe43d-d77a-4d3c-b3ff-1a422298dd50)
# Testing Photographs and Procedure
<details>
<summary>Test here</summary>


https://github.com/cmss13-devs/cmss13/assets/54422837/cd5753fb-0909-4957-8867-a06a093eaacc


Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
no player facing changes
  • Loading branch information
private-tristan committed Jan 24, 2024
1 parent edf884a commit 37dd2f1
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 37dd2f1

Please sign in to comment.