diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 2cb8bbb396e..6f5e692c311 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1728,6 +1728,39 @@ Eyes need to have significantly high darksight to shine unless the mob has the X return ..() +/mob/living/carbon/human/proc/do_cpr(mob/living/carbon/human/H) + if(H.stat == DEAD || (H.status_flags & FAKEDEATH)) + to_chat(src, "[H.name] is dead!") + return + if(!check_has_mouth()) + to_chat(src, "You don't have a mouth, you cannot perform CPR!") + return + if(!H.check_has_mouth()) + to_chat(src, "They don't have a mouth, you cannot perform CPR!") + return + if((head && (head.flags_cover & HEADCOVERSMOUTH)) || (wear_mask && (wear_mask.flags_cover & MASKCOVERSMOUTH) && !wear_mask.mask_adjusted)) + to_chat(src, "Remove your mask first!") + return 0 + if((H.head && (H.head.flags_cover & HEADCOVERSMOUTH)) || (H.wear_mask && (H.wear_mask.flags_cover & MASKCOVERSMOUTH) && !H.wear_mask.mask_adjusted)) + to_chat(src, "Remove their mask first!") + return 0 + visible_message("[src] is trying to perform CPR on [H.name]!", \ + "You try to perform CPR on [H.name]!") + if(do_mob(src, H, 40)) + if(H.health > config.health_threshold_dead && H.health <= config.health_threshold_crit) + var/suff = min(H.getOxyLoss(), 7) + H.adjustOxyLoss(-suff) + H.updatehealth() + visible_message("[src] performs CPR on [H.name]!", \ + "You perform CPR on [H.name].") + + to_chat(H, "You feel a breath of fresh air enter your lungs. It feels good.") + to_chat(src, "Repeat at least every 7 seconds.") + add_logs(src, H, "CPRed") + return 1 + else + to_chat(src, "You need to stay still while performing CPR!") + /mob/living/carbon/human/canBeHandcuffed() if(get_num_arms() >= 2) return TRUE diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 8bc5ccfd6b4..cd10e5b3e60 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -322,35 +322,8 @@ target.help_shake_act(user) add_attack_logs(user, target, "Shaked") return 1 - if(!user.check_has_mouth()) - to_chat(user, "You don't have a mouth, you cannot perform CPR!") - return - if(!target.check_has_mouth()) - to_chat(user, "They don't have a mouth, you cannot perform CPR!") - return - if((user.head && (user.head.flags_cover & HEADCOVERSMOUTH)) || (user.wear_mask && (user.wear_mask.flags_cover & MASKCOVERSMOUTH) && !user.wear_mask.mask_adjusted)) - to_chat(user, "Remove your mask!") - return 0 - if((target.head && (target.head.flags_cover & HEADCOVERSMOUTH)) || (target.wear_mask && (target.wear_mask.flags_cover & MASKCOVERSMOUTH) && !target.wear_mask.mask_adjusted)) - to_chat(user, "Remove his mask!") - return 0 - - user.visible_message("\The [user] is trying to perform CPR on \the [target]!", \ - "You try to perform CPR on \the [target]!") - if(do_mob(user, target, 40)) - if(target.health > config.health_threshold_dead && target.health <= config.health_threshold_crit) - var/suff = min(target.getOxyLoss(), 7) - target.adjustOxyLoss(-suff) - target.updatehealth() - user.visible_message("\The [user] performs CPR on \the [target]!", \ - "You perform CPR on \the [target].") - - to_chat(target, "You feel a breath of fresh air enter your lungs. It feels good.") - to_chat(user, "Repeat at least every 7 seconds.") - add_attack_logs(user, target, "CPRed", FALSE) - return 1 else - to_chat(user, "You need to stay still while performing CPR!") + user.do_cpr(target) /datum/species/proc/grab(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) if(attacker_style && attacker_style.grab_act(user, target))