Allow cursed heart to be defibrillated up to three times (#18677)

* cursed heart but funny

* Flesh out this version a bit more

* okay fine you get three shots

miner gaming

* Bitwise

* Change wakeup method

* Address Steel's review
This commit is contained in:
Luc
2022-08-24 12:00:25 -05:00
committed by GitHub
parent b8cf8fa091
commit ad813f76d9
4 changed files with 87 additions and 6 deletions
+13 -3
View File
@@ -404,7 +404,10 @@
var/total_burn = 0
var/total_brute = 0
var/signal_result = SEND_SIGNAL(M, COMSIG_LIVING_PRE_DEFIB, user, defib, ghost)
if(do_after(user, 20 * toolspeed, target = M)) //placed on chest and short delay to shock for dramatic effect, revive time is 5sec total
signal_result |= SEND_SIGNAL(M, COMSIG_LIVING_DEFIBBED, user, defib, ghost)
for(var/obj/item/carried_item in H.contents)
if(istype(carried_item, /obj/item/clothing/suit/space))
if(!defib.combat)
@@ -413,6 +416,9 @@
busy = FALSE
update_icon(UPDATE_ICON_STATE)
return
if(signal_result & COMPONENT_DEFIB_OVERRIDE)
// let our signal handle it
return
if(H.undergoing_cardiac_arrest())
if(!H.get_int_organ(/obj/item/organ/internal/heart) && !H.get_int_organ(/obj/item/organ/internal/brain/slime)) //prevents defibing someone still alive suffering from a heart attack attack if they lack a heart
user.visible_message("<span class='boldnotice'>[defib] buzzes: Resuscitation failed - Failed to pick up any heart electrical activity.</span>")
@@ -450,7 +456,7 @@
total_brute += O.brute_dam
total_burn += O.burn_dam
ghost = H.get_ghost(TRUE) // We have to double check whether the dead guy has entered their body during the above
if(total_burn <= 180 && total_brute <= 180 && !H.suiciding && !ghost && tplus < tlimit && !HAS_TRAIT(H, TRAIT_HUSK) && !HAS_TRAIT(H, TRAIT_BADDNA) && H.blood_volume > BLOOD_VOLUME_SURVIVE && (H.get_int_organ(/obj/item/organ/internal/heart) || H.get_int_organ(/obj/item/organ/internal/brain/slime)))
if(total_burn <= 180 && total_brute <= 180 && !H.suiciding && !ghost && tplus < tlimit && !HAS_TRAIT(H, TRAIT_HUSK) && !HAS_TRAIT(H, TRAIT_BADDNA) && H.blood_volume > BLOOD_VOLUME_SURVIVE && (H.get_int_organ(/obj/item/organ/internal/heart) || H.get_int_organ(/obj/item/organ/internal/brain/slime)) && !(signal_result & COMPONENT_BLOCK_DEFIB))
tobehealed = min(health + threshold, 0) // It's HILARIOUS without this min statement, let me tell you
tobehealed -= 5 //They get 5 of each type of damage healed so excessive combined damage will not immediately kill them after they get revived
H.adjustOxyLoss(tobehealed)
@@ -493,7 +499,7 @@
user.visible_message("<span class='boldnotice'>[defib] buzzes: Resuscitation failed: Patient blood volume critically low.</span>")
else if(ghost)
if(!ghost.can_reenter_corpse) // DNR or AntagHUD
user.visible_message("<span class='boldnotice'>[defib] buzzes: Resucitation failed: No electrical brain activity detected.</span>")
user.visible_message("<span class='boldnotice'>[defib] buzzes: Resuscitation failed: No electrical brain activity detected.</span>")
else
user.visible_message("<span class='boldnotice'>[defib] buzzes: Resuscitation failed: Patient's brain is unresponsive. Further attempts may succeed.</span>")
else
@@ -593,7 +599,10 @@
var/tloss = 600 //brain damage starts setting in on the patient after some time left rotting
var/total_burn = 0
var/total_brute = 0
var/signal_result = SEND_SIGNAL(M, COMSIG_LIVING_PRE_DEFIB, user, src, ghost)
if(do_after(user, 20 * toolspeed, target = M)) //placed on chest and short delay to shock for dramatic effect, revive time is 5sec total
signal_result |= SEND_SIGNAL(M, COMSIG_LIVING_DEFIBBED, user, src, ghost)
if(H.stat == DEAD)
var/health = H.health
M.visible_message("<span class='warning'>[M]'s body convulses a bit.")
@@ -602,7 +611,7 @@
for(var/obj/item/organ/external/O in H.bodyparts)
total_brute += O.brute_dam
total_burn += O.burn_dam
if(total_burn <= 180 && total_brute <= 180 && !H.suiciding && !ghost && tplus < tlimit && !HAS_TRAIT(H, TRAIT_HUSK))
if(total_burn <= 180 && total_brute <= 180 && !H.suiciding && !ghost && tplus < tlimit && !HAS_TRAIT(H, TRAIT_HUSK) && !(signal_result & COMPONENT_BLOCK_DEFIB))
tobehealed = min(health + threshold, 0) // It's HILARIOUS without this min statement, let me tell you
tobehealed -= 5 //They get 5 of each type of damage healed so excessive combined damage will not immediately kill them after they get revived
H.adjustOxyLoss(tobehealed)
@@ -618,6 +627,7 @@
if(tplus > tloss)
H.setBrainLoss( max(0, min(99, ((tlimit - tplus) / tlimit * 100))))
SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK, 100)
SEND_SIGNAL(H, COMSIG_LIVING_DEFIBBED, user, src)
if(isrobot(user))
var/mob/living/silicon/robot/R = user
R.cell.use(revivecost)