From 29932437b5fa91d5f28d4d7d9a9071500bd6329d Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Tue, 23 Feb 2021 11:55:47 +0000 Subject: [PATCH] Fire Hugging V2 (#15563) --- .../mob/living/carbon/alien/alien_defense.dm | 5 ++- code/modules/mob/living/carbon/carbon.dm | 45 +++++++++++-------- .../living/carbon/human/species/_species.dm | 4 +- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/code/modules/mob/living/carbon/alien/alien_defense.dm b/code/modules/mob/living/carbon/alien/alien_defense.dm index c88a592a01b..08ac8637572 100644 --- a/code/modules/mob/living/carbon/alien/alien_defense.dm +++ b/code/modules/mob/living/carbon/alien/alien_defense.dm @@ -42,7 +42,10 @@ In all, this is a lot like the monkey code. /N switch(M.a_intent) if(INTENT_HELP) - help_shake_act(M) + if(M.on_fire) + pat_out(M) + else + help_shake_act(M) if(INTENT_GRAB) grabbedby(M) if(INTENT_HARM) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 81a0174a945..2cf1b8116a0 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -238,25 +238,6 @@ "[M] shakes [src] trying to wake [p_them()] up!",\ "You shake [src] trying to wake [p_them()] up!",\ ) - - else if(on_fire) - var/self_message = "You try to extinguish [src]!" - if(prob(30) && ishuman(M)) // 30% chance of burning your hands - var/mob/living/carbon/human/H = M - var/protected = FALSE // Protected from the fire - if((H.gloves?.max_heat_protection_temperature > 360) || HAS_TRAIT(H, TRAIT_RESISTHEAT) || HAS_TRAIT(H, TRAIT_RESISTHEATHANDS)) - protected = TRUE - - var/obj/item/organ/external/active_hand = H.get_organ("[H.hand ? "l" : "r"]_hand") - if(active_hand && !protected) // Wouldn't really work without a hand - active_hand.receive_damage(0, 5) - self_message = "You burn your hand trying to extinguish [src]!" - H.update_icons() - - M.visible_message("[M] tries to extinguish [src]!", self_message) - playsound(get_turf(src), 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - adjust_fire_stacks(-0.5) - // BEGIN HUGCODE - N3X else playsound(get_turf(src), 'sound/weapons/thudswoosh.ogg', 50, 1, -1) @@ -278,6 +259,32 @@ else if(H.w_uniform) H.w_uniform.add_fingerprint(M) +/** + * Handles patting out a fire on someone. + * + * Removes 0.5 fire stacks per pat, with a 30% chance of the user burning their hand if they don't have adequate heat resistance. + * Arguments: + * * src - The mob doing the patting + * * target - The mob who is currently on fire + */ +/mob/living/carbon/proc/pat_out(mob/living/target) + var/self_message = "You try to extinguish [target]!" + if(prob(30) && ishuman(src)) // 30% chance of burning your hands + var/mob/living/carbon/human/H = src + var/protected = FALSE // Protected from the fire + if((H.gloves?.max_heat_protection_temperature > 360) || HAS_TRAIT(H, TRAIT_RESISTHEAT) || HAS_TRAIT(H, TRAIT_RESISTHEATHANDS)) + protected = TRUE + + var/obj/item/organ/external/active_hand = H.get_active_hand() + if(active_hand && !protected) // Wouldn't really work without a hand + active_hand.receive_damage(0, 5) + self_message = "You burn your hand trying to extinguish [target]!" + H.update_icons() + + target.visible_message("[src] tries to extinguish [target]!", self_message) + playsound(target, 'sound/weapons/thudswoosh.ogg', 50, TRUE, -1) + target.adjust_fire_stacks(-0.5) + /mob/living/carbon/proc/check_self_for_injuries() var/mob/living/carbon/human/H = src visible_message( \ diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm index ad919c080be..95827020eb8 100644 --- a/code/modules/mob/living/carbon/human/species/_species.dm +++ b/code/modules/mob/living/carbon/human/species/_species.dm @@ -387,7 +387,9 @@ /datum/species/proc/help(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) if(attacker_style && attacker_style.help_act(user, target) == TRUE)//adminfu only... return TRUE - if(target.health >= HEALTH_THRESHOLD_CRIT && !HAS_TRAIT(target, TRAIT_FAKEDEATH)) + if(target.on_fire) + user.pat_out(target) + else if(target.health >= HEALTH_THRESHOLD_CRIT && !HAS_TRAIT(target, TRAIT_FAKEDEATH)) target.help_shake_act(user) return TRUE else