From 2b614abfe24e7a61f06b71f1bbb86f25fa6b4983 Mon Sep 17 00:00:00 2001 From: hal9000PR Date: Tue, 17 Aug 2021 14:39:05 +0100 Subject: [PATCH 1/4] compression only CPR --- code/modules/mob/living/carbon/human/human.dm | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 9c8635afa9e..8168ec1c15f 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1593,6 +1593,9 @@ Eyes need to have significantly high darksight to shine unless the mob has the X return ..() +#define CPR_CHEST_COMPRESSION_ONLY 0.75 +#define CPR_RESCUE_BREATHS 1 + /mob/living/carbon/human/proc/do_cpr(mob/living/carbon/human/H) if(H == src) to_chat(src, "You cannot perform CPR on yourself!") @@ -1600,26 +1603,19 @@ Eyes need to have significantly high darksight to shine unless the mob has the X if(H.stat == DEAD || HAS_TRAIT(H, TRAIT_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 - 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 [H.p_their()] mask first!") - return if(H.receiving_cpr) // To prevent spam stacking to_chat(src, "They are already receiving CPR!") return - visible_message("[src] is trying to perform CPR on [H.name]!", "You try to perform CPR on [H.name]!") H.receiving_cpr = TRUE + var/cpr_modifier = get_cpr_mod(H) + if(cpr_modifier == CPR_RESCUE_BREATHS) + visible_message("[src] is trying to perform chest compressions and rescue breaths on [H.name]!", "You try to perform chest compressions and rescue breaths on [H.name]!") + else + visible_message("[src] is trying to perform chest compressions on [H.name]!", "You try to perform chest compressions on [H.name]!") + if(do_mob(src, H, 40)) if(H.health <= HEALTH_THRESHOLD_CRIT) - H.adjustOxyLoss(-15) + H.adjustOxyLoss(-15 * cpr_modifier) H.SetLoseBreath(0) H.AdjustParalysis(-1) H.updatehealth("cpr") @@ -1633,6 +1629,15 @@ Eyes need to have significantly high darksight to shine unless the mob has the X H.receiving_cpr = FALSE to_chat(src, "You need to stay still while performing CPR!") +/mob/living/carbon/human/proc/get_cpr_mod(mob/living/carbon/human/H) + if((head && (head.flags_cover & HEADCOVERSMOUTH)) || (wear_mask && (wear_mask.flags_cover & MASKCOVERSMOUTH) && !wear_mask.mask_adjusted)) + return CPR_CHEST_COMPRESSION_ONLY + if((H.head && (H.head.flags_cover & HEADCOVERSMOUTH)) || (H.wear_mask && (H.wear_mask.flags_cover & MASKCOVERSMOUTH) && !H.wear_mask.mask_adjusted)) + return CPR_CHEST_COMPRESSION_ONLY + if(!H.check_has_mouth() || !check_has_mouth()) + return CPR_CHEST_COMPRESSION_ONLY + return CPR_RESCUE_BREATHS + /mob/living/carbon/human/canBeHandcuffed() if(get_num_arms() >= 2) return TRUE From 429d81eb497a8ee1fa0c11facf9bc5d19248b96d Mon Sep 17 00:00:00 2001 From: hal9000PR Date: Tue, 17 Aug 2021 14:40:22 +0100 Subject: [PATCH 2/4] SECONDS --- code/modules/mob/living/carbon/human/human.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 8168ec1c15f..9c75dd3ede5 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1613,7 +1613,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X else visible_message("[src] is trying to perform chest compressions on [H.name]!", "You try to perform chest compressions on [H.name]!") - if(do_mob(src, H, 40)) + if(do_mob(src, H, 4 SECONDS)) if(H.health <= HEALTH_THRESHOLD_CRIT) H.adjustOxyLoss(-15 * cpr_modifier) H.SetLoseBreath(0) From ea5f25f3f9757a138b311c45bb5d3867fd4542b8 Mon Sep 17 00:00:00 2001 From: hal9000PR Date: Tue, 17 Aug 2021 15:18:00 +0100 Subject: [PATCH 3/4] undefine --- code/modules/mob/living/carbon/human/human.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 9c75dd3ede5..e19e5c2ddbb 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1638,6 +1638,9 @@ Eyes need to have significantly high darksight to shine unless the mob has the X return CPR_CHEST_COMPRESSION_ONLY return CPR_RESCUE_BREATHS +#undef CPR_CHEST_COMPRESSION_ONLY +#undef CPR_RESCUE_BREATHS + /mob/living/carbon/human/canBeHandcuffed() if(get_num_arms() >= 2) return TRUE From be7ca2e19b218adb3f5a93a57444b0749f8be2e7 Mon Sep 17 00:00:00 2001 From: hal9000PR Date: Sat, 18 Sep 2021 20:12:06 +0100 Subject: [PATCH 4/4] review --- code/modules/mob/living/carbon/human/human.dm | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index e19e5c2ddbb..77a0df3ba3c 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1608,10 +1608,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X return H.receiving_cpr = TRUE var/cpr_modifier = get_cpr_mod(H) - if(cpr_modifier == CPR_RESCUE_BREATHS) - visible_message("[src] is trying to perform chest compressions and rescue breaths on [H.name]!", "You try to perform chest compressions and rescue breaths on [H.name]!") - else - visible_message("[src] is trying to perform chest compressions on [H.name]!", "You try to perform chest compressions on [H.name]!") + visible_message("[src] is trying to perform CPR on [H.name]!", "You try to perform CPR on [H.name]!") if(do_mob(src, H, 4 SECONDS)) if(H.health <= HEALTH_THRESHOLD_CRIT) @@ -1621,7 +1618,8 @@ Eyes need to have significantly high darksight to shine unless the mob has the X H.updatehealth("cpr") 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.") + if(cpr_modifier == CPR_RESCUE_BREATHS) + to_chat(H, "You feel a breath of fresh air enter your lungs. It feels good.") H.receiving_cpr = FALSE add_attack_logs(src, H, "CPRed", ATKLOG_ALL) return TRUE @@ -1630,9 +1628,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X to_chat(src, "You need to stay still while performing CPR!") /mob/living/carbon/human/proc/get_cpr_mod(mob/living/carbon/human/H) - if((head && (head.flags_cover & HEADCOVERSMOUTH)) || (wear_mask && (wear_mask.flags_cover & MASKCOVERSMOUTH) && !wear_mask.mask_adjusted)) - return CPR_CHEST_COMPRESSION_ONLY - if((H.head && (H.head.flags_cover & HEADCOVERSMOUTH)) || (H.wear_mask && (H.wear_mask.flags_cover & MASKCOVERSMOUTH) && !H.wear_mask.mask_adjusted)) + if(is_mouth_covered() || H.is_mouth_covered()) return CPR_CHEST_COMPRESSION_ONLY if(!H.check_has_mouth() || !check_has_mouth()) return CPR_CHEST_COMPRESSION_ONLY