diff --git a/code/datums/components/defibrillator.dm b/code/datums/components/defibrillator.dm
index 44d35fdf8b8..945df4b16ed 100644
--- a/code/datums/components/defibrillator.dm
+++ b/code/datums/components/defibrillator.dm
@@ -304,6 +304,10 @@
for(var/obj/item/grab/G in target.grabbed_by)
if(ishuman(G.assailant))
excess_shock(user, target, G.assailant, defib_ref)
+ if(target.receiving_cpr_from)
+ var/mob/living/carbon/human/H = locateUID(target.receiving_cpr_from)
+ if(istype(H))
+ excess_shock(user, target, H, defib_ref)
target.med_hud_set_health()
target.med_hud_set_status()
diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm
index 74113625e2e..ddd10970e26 100644
--- a/code/modules/mob/living/carbon/human/human_defines.dm
+++ b/code/modules/mob/living/carbon/human/human_defines.dm
@@ -71,7 +71,9 @@
var/check_mutations=0 // Check mutations on next life tick
var/heartbeat = 0
- var/receiving_cpr = FALSE
+
+ /// UID of the person who is giving this mob CPR.
+ var/receiving_cpr_from
var/fire_dmi = 'icons/mob/OnFire.dmi'
var/fire_sprite = "Standing"
diff --git a/code/modules/mob/living/carbon/human/human_mob.dm b/code/modules/mob/living/carbon/human/human_mob.dm
index e8a9edd5fe1..aa6df58de40 100644
--- a/code/modules/mob/living/carbon/human/human_mob.dm
+++ b/code/modules/mob/living/carbon/human/human_mob.dm
@@ -1678,7 +1678,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
if(H == src)
to_chat(src, "You cannot perform CPR on yourself!")
return
- if(H.receiving_cpr) // To prevent spam stacking
+ if(!isnull(H.receiving_cpr_from)) // To prevent spam stacking
to_chat(src, "They are already receiving CPR!")
return
if(!can_use_hands() || !has_both_hands())
@@ -1688,7 +1688,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
to_chat(src, "You can't perform effective CPR with your hands full!")
return
- H.receiving_cpr = TRUE
+ H.receiving_cpr_from = UID()
var/cpr_modifier = get_cpr_mod(H)
if(H.stat == DEAD || HAS_TRAIT(H, TRAIT_FAKEDEATH))
if(ismachineperson(H) && do_mob(src, H, 4 SECONDS)) // hehe
@@ -1698,12 +1698,12 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
)
playsound(H, 'sound/weapons/ringslam.ogg', 50, TRUE)
adjustBruteLossByPart(2, "head")
- H.receiving_cpr = FALSE
+ H.receiving_cpr_from = null
return
if(!H.is_revivable())
to_chat(src, "[H] is already too far gone for CPR...")
- H.receiving_cpr = FALSE
+ H.receiving_cpr_from = null
return
visible_message("[src] is trying to perform CPR on [H]'s lifeless body!", "You start trying to perform CPR on [H]'s lifeless body!")
@@ -1740,7 +1740,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
else
visible_message("[src] stops giving [H] CPR.", "You stop giving [H] CPR.")
- H.receiving_cpr = FALSE
+ H.receiving_cpr_from = null
return
visible_message("[src] is trying to perform CPR on [H.name]!", "You try to perform CPR on [H.name]!")
@@ -1759,7 +1759,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
to_chat(H, "You feel a breath of fresh air enter your lungs. It feels good.")
add_attack_logs(src, H, "CPRed", ATKLOG_ALL)
- H.receiving_cpr = FALSE
+ H.receiving_cpr_from = null
visible_message("[src] stops performing CPR on [H].", "You stop performing CPR on [H].")
to_chat(src, "You need to stay still while performing CPR!")