Skip to content

Commit

Permalink
CPR tweaks (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMelbert authored Nov 19, 2023
1 parent fb2d6a6 commit 3db14b8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
17 changes: 12 additions & 5 deletions code/modules/mob/living/carbon/human/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1121,13 +1121,20 @@ GLOBAL_LIST_EMPTY(features_by_species)
if(attacker_style?.help_act(user, target) == MARTIAL_ATTACK_SUCCESS)
return TRUE

if(!target.undergoing_cardiac_arrest() && (target.body_position == STANDING_UP || target.appears_alive())) // NON-MODULE CHANGE
target.help_shake_act(user)
if(target != user)
log_combat(user, target, "shaken")
// NON-MODULE CHANGE START
if(!target.appears_alive())
to_chat(src, span_warning("[target] is dead!"))
return FALSE

if(target.body_position == LYING_DOWN && (target.undergoing_cardiac_arrest() || target.stat != CONSCIOUS))
user.do_cpr(target)
return TRUE

user.do_cpr(target)
target.help_shake_act(user)
if(target != user)
log_combat(user, target, "shaken")
return TRUE
// NON-MODULE CHANGE END

/datum/species/proc/grab(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style)
if(target.check_block())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
to_chat(src, span_warning("[target.name] is dead!"))
return

var/cpr_certified = HAS_TRAIT(src, TRAIT_CPR_CERTIFIED)
if(!panicking && target.stat != CONSCIOUS && beat >= BEATS_PER_CPR_CYCLE + 1)
to_chat(src, span_warning("[target] still isn't up[HAS_TRAIT(src, TRAIT_CPR_CERTIFIED) ? " - you pick up the pace." : "! You try harder!"]"))
to_chat(src, span_warning("[target] still isn't up[cpr_certified ? " - you pick up the pace." : "! You try harder!"]"))
panicking = TRUE

var/doafter_mod = panicking ? 0.5 : 1

var/doing_a_breath = FALSE
if(beat % BEATS_PER_CPR_CYCLE == 0)
if (is_mouth_covered())
Expand Down Expand Up @@ -78,16 +78,19 @@
)

target.apply_status_effect(/datum/status_effect/cpr_applied)
// compressions help a little bit with oxyloss, to simulate blood flow returning to your body
target.adjustOxyLoss(-0.5 * (cpr_certified ? 2 : 1))

if(doing_a_breath)
if(HAS_TRAIT(target, TRAIT_NOBREATH))
to_chat(target, span_unconscious("You feel a breath of fresh air... which is a sensation you don't recognise..."))
else if (!target.get_organ_slot(ORGAN_SLOT_LUNGS))
to_chat(target, span_unconscious("You feel a breath of fresh air... but you don't feel any better..."))
else if(HAS_TRAIT(src, TRAIT_CPR_CERTIFIED))
target.adjustOxyLoss(-20)
else if(cpr_certified)
target.adjustOxyLoss(-18)
to_chat(target, span_unconscious("You feel a breath of fresh air enter your lungs... It feels good..."))
else
// but breaths are where the real oxyloss is healed
target.adjustOxyLoss(-12)
to_chat(target, span_unconscious("You feel a breath of fresh air enter your lungs..."))

Expand All @@ -104,7 +107,7 @@
var/obj/item/bodypart/chest/chest = target.get_bodypart(BODY_ZONE_CHEST)
if(IS_ORGANIC_LIMB(chest))
var/critical_success = prob(1) && target.undergoing_cardiac_arrest()
if(!HAS_TRAIT(src, TRAIT_CPR_CERTIFIED))
if(!cpr_certified)
// Apply damage directly to chest. I would use apply damage but I can't, kinda
if(critical_success)
target.set_heartattack(FALSE)
Expand Down

0 comments on commit 3db14b8

Please sign in to comment.