From a020e28305a6154ca771f68133ad1fbcf4f82a45 Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Mon, 9 May 2022 11:58:00 -0500 Subject: [PATCH] Removes "strandling" status effect from a bunch of random places / refactors it (#66711) Refactors /datum/status_effect/strandling to utilize signals so that it's not present in a bunch of random places via hard checks and traits. --- .../signals/signals_mob/signals_mob_carbon.dm | 17 ++- code/__DEFINES/traits.dm | 1 - code/_globalvars/traits.dm | 1 - code/datums/brain_damage/creepy_trauma.dm | 5 +- code/datums/quirks/negative.dm | 7 +- code/datums/status_effects/debuffs/debuffs.dm | 38 ------- .../status_effects/debuffs/strandling.dm | 106 ++++++++++++++++++ code/game/objects/items/tools/crowbar.dm | 11 +- code/game/objects/items/tools/wirecutters.dm | 11 +- .../mob/living/carbon/carbon_defense.dm | 89 ++++++++------- .../mob/living/carbon/human/human_defense.dm | 26 ++--- code/modules/mob/living/carbon/life.dm | 4 +- tgstation.dme | 1 + 13 files changed, 188 insertions(+), 129 deletions(-) create mode 100644 code/datums/status_effects/debuffs/strandling.dm diff --git a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm index 369d64f9cbe..8d8e741416d 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_carbon.dm @@ -1,7 +1,13 @@ -///When a carbon mob hugs someone, this is called on the carbon that is hugging. (mob/living/hugger, mob/living/hugged) -#define COMSIG_CARBON_HUG "carbon_hug" -///When a carbon mob is hugged, this is called on the carbon that is hugged. (mob/living/hugger) -#define COMSIG_CARBON_HUGGED "carbon_hugged" +///Called from /mob/living/carbon/help_shake_act, before any hugs have ocurred. (mob/living/helper) +#define COMSIG_CARBON_PRE_HELP_ACT "carbon_pre_help" + /// Stops the rest of help act (hugging, etc) from occuring + #define COMPONENT_BLOCK_HELP_ACT (1<<0) + +///Called from /mob/living/carbon/help_shake_act on the person being helped, after any hugs have ocurred. (mob/living/helper) +#define COMSIG_CARBON_HELP_ACT "carbon_help" +///Called from /mob/living/carbon/help_shake_act on the helper, after any hugs have ocurred. (mob/living/helped) +#define COMSIG_CARBON_HELPED "carbon_helped_someone" + ///Before a carbon mob is shoved, sent to the turf we're trying to shove onto (mob/living/carbon/shover, mob/living/carbon/target) #define COMSIG_CARBON_DISARM_PRESHOVE "carbon_disarm_preshove" #define COMSIG_CARBON_ACT_SOLID (1<<0) //Tells disarm code to act as if the mob was shoved into something solid, even we we're not @@ -58,6 +64,9 @@ #define COMSIG_CARBON_HEALTH_UPDATE "carbon_health_update" ///Called when a carbon updates their sanity (source = carbon) #define COMSIG_CARBON_SANITY_UPDATE "carbon_sanity_update" +///Called when a carbon breathes, before the breath has actually occured +#define COMSIG_CARBON_PRE_BREATHE "carbon_pre_breathe" + // /mob/living/carbon/human signals ///Hit by successful disarm attack (mob/living/carbon/human/attacker,zone_targeted) diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 30357f88cf0..f17e9f40ac1 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -266,7 +266,6 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_ABDUCTOR_SCIENTIST_TRAINING "abductor-scientist-training" #define TRAIT_SURGEON "surgeon" #define TRAIT_STRONG_GRABBER "strong_grabber" -#define TRAIT_MAGIC_CHOKE "magic_choke" #define TRAIT_SOOTHED_THROAT "soothed-throat" #define TRAIT_BOOZE_SLIDER "booze-slider" /// We place people into a fireman carry quicker than standard diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index 7876bc30edb..bee3dbf2760 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -98,7 +98,6 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_ABDUCTOR_SCIENTIST_TRAINING" = TRAIT_ABDUCTOR_SCIENTIST_TRAINING, "TRAIT_SURGEON" = TRAIT_SURGEON, "TRAIT_STRONG_GRABBER" = TRAIT_STRONG_GRABBER, - "TRAIT_MAGIC_CHOKE" = TRAIT_MAGIC_CHOKE, "TRAIT_SOOTHED_THROAT" = TRAIT_SOOTHED_THROAT, "TRAIT_LAW_ENFORCEMENT_METABOLISM" = TRAIT_LAW_ENFORCEMENT_METABOLISM, "TRAIT_BOOZE_SLIDER" = TRAIT_BOOZE_SLIDER, diff --git a/code/datums/brain_damage/creepy_trauma.dm b/code/datums/brain_damage/creepy_trauma.dm index 9eaae4ce566..bb7a210ead1 100644 --- a/code/datums/brain_damage/creepy_trauma.dm +++ b/code/datums/brain_damage/creepy_trauma.dm @@ -34,7 +34,7 @@ //antag stuff// antagonist.forge_objectives(obsession.mind) antagonist.greet() - RegisterSignal(owner, COMSIG_CARBON_HUG, .proc/on_hug) + RegisterSignal(owner, COMSIG_CARBON_HELPED, .proc/on_hug) /datum/brain_trauma/special/obsessed/on_life(delta_time, times_fired) if(!obsession || obsession.stat == DEAD) @@ -80,7 +80,8 @@ to_chat(owner, span_warning("Being near [obsession] makes you nervous and you begin to stutter...")) owner.set_timed_status_effect(6 SECONDS, /datum/status_effect/speech/stutter, only_if_higher = TRUE) -/datum/brain_trauma/special/obsessed/proc/on_hug(datum/source, mob/living/hugger, mob/living/hugged) +/// Singal proc for [COMSIG_CARBON_HELPED], when our obsessed helps (hugs) our obsession, increases hug count +/datum/brain_trauma/special/obsessed/proc/on_hug(datum/source, mob/living/hugged) SIGNAL_HANDLER if(hugged != obsession) diff --git a/code/datums/quirks/negative.dm b/code/datums/quirks/negative.dm index aff999fcf2f..57f34be5f89 100644 --- a/code/datums/quirks/negative.dm +++ b/code/datums/quirks/negative.dm @@ -826,12 +826,13 @@ hardcore_value = 1 /datum/quirk/bad_touch/add() - RegisterSignal(quirk_holder, list(COMSIG_LIVING_GET_PULLED, COMSIG_CARBON_HUGGED), .proc/uncomfortable_touch) + RegisterSignal(quirk_holder, list(COMSIG_LIVING_GET_PULLED, COMSIG_CARBON_HELP_ACT), .proc/uncomfortable_touch) /datum/quirk/bad_touch/remove() - UnregisterSignal(quirk_holder, list(COMSIG_LIVING_GET_PULLED, COMSIG_CARBON_HUGGED)) + UnregisterSignal(quirk_holder, list(COMSIG_LIVING_GET_PULLED, COMSIG_CARBON_HELP_ACT)) -/datum/quirk/bad_touch/proc/uncomfortable_touch() +/// Causes a negative moodlet to our quirk holder on signal +/datum/quirk/bad_touch/proc/uncomfortable_touch(datum/source) SIGNAL_HANDLER if(quirk_holder.stat == DEAD) diff --git a/code/datums/status_effects/debuffs/debuffs.dm b/code/datums/status_effects/debuffs/debuffs.dm index 86d58171883..ea4177d7ffa 100644 --- a/code/datums/status_effects/debuffs/debuffs.dm +++ b/code/datums/status_effects/debuffs/debuffs.dm @@ -251,44 +251,6 @@ desc = "Your biological functions have halted. You could live forever this way, but it's pretty boring." icon_state = "stasis" -//GOLEM GANG - -//OTHER DEBUFFS -/datum/status_effect/strandling //get it, strand as in durathread strand + strangling = strandling hahahahahahahahahahhahahaha i want to die - id = "strandling" - status_type = STATUS_EFFECT_UNIQUE - alert_type = /atom/movable/screen/alert/status_effect/strandling - -/datum/status_effect/strandling/on_apply() - ADD_TRAIT(owner, TRAIT_MAGIC_CHOKE, STATUS_EFFECT_TRAIT) - return ..() - -/datum/status_effect/strandling/on_remove() - REMOVE_TRAIT(owner, TRAIT_MAGIC_CHOKE, STATUS_EFFECT_TRAIT) - return ..() - -/datum/status_effect/strandling/get_examine_text() - return span_warning("[owner.p_they(TRUE)] seem[owner.p_s()] to be being choked by some durathread strands. You may be able to cut them off.") - -/atom/movable/screen/alert/status_effect/strandling - name = "Choking strand" - desc = "A magical strand of Durathread is wrapped around your neck, preventing you from breathing! Click this icon to remove the strand." - icon_state = "his_grace" - alerttooltipstyle = "hisgrace" - -/atom/movable/screen/alert/status_effect/strandling/Click(location, control, params) - . = ..() - if(!.) - return - - to_chat(owner, span_notice("You attempt to remove the durathread strand from around your neck.")) - if(do_after(owner, 3.5 SECONDS, owner)) - if(isliving(owner)) - var/mob/living/living_owner = owner - to_chat(living_owner, span_notice("You succesfuly remove the durathread strand.")) - living_owner.remove_status_effect(/datum/status_effect/strandling) - -//OTHER DEBUFFS /datum/status_effect/pacify id = "pacify" status_type = STATUS_EFFECT_REPLACE diff --git a/code/datums/status_effects/debuffs/strandling.dm b/code/datums/status_effects/debuffs/strandling.dm new file mode 100644 index 00000000000..9dc9ede90d6 --- /dev/null +++ b/code/datums/status_effects/debuffs/strandling.dm @@ -0,0 +1,106 @@ +/// A multiplier to the time it takes to remove durathread strangling when using a tool instead of your hands +#define STRANGLING_TOOL_MULTIPLIER 0.4 + +//get it, strand as in durathread strand + strangling = strandling hahahahahahahahahahhahahaha i want to die +/datum/status_effect/strandling + id = "strandling" + status_type = STATUS_EFFECT_UNIQUE + alert_type = /atom/movable/screen/alert/status_effect/strandling + /// How long it takes to remove the status effect via [proc/try_remove_effect] + var/time_to_remove = 3.5 SECONDS + +/datum/status_effect/strandling/on_apply() + RegisterSignal(owner, COMSIG_CARBON_PRE_BREATHE, .proc/on_breathe) + RegisterSignal(owner, COMSIG_ATOM_TOOL_ACT(TOOL_WIRECUTTER), .proc/on_cut) + RegisterSignal(owner, COMSIG_CARBON_PRE_HELP_ACT, .proc/on_self_check) + return TRUE + +/datum/status_effect/strandling/on_remove() + UnregisterSignal(owner, list(COMSIG_CARBON_PRE_BREATHE, COMSIG_ATOM_TOOL_ACT(TOOL_WIRECUTTER), COMSIG_CARBON_PRE_HELP_ACT)) + +/datum/status_effect/strandling/get_examine_text() + return span_warning("[owner.p_they(TRUE)] seem[owner.p_s()] to be being choked by some durathread strands. You may be able to cut them off.") + +/// Signal proc for [COMSIG_CARBON_PRE_BREATHE], causes losebreath whenever we're trying to breathe +/datum/status_effect/strandling/proc/on_breathe(mob/living/source) + SIGNAL_HANDLER + + if(source.getorganslot(ORGAN_SLOT_BREATHING_TUBE)) + return + + source.losebreath++ + +/// Signal proc for [COMSIG_ATOM_TOOL_ACT] with [TOOL_WIRECUTTER], allowing wirecutters to remove the effect (from others / themself) +/datum/status_effect/strandling/proc/on_cut(mob/living/source, mob/user, obj/item/tool) + SIGNAL_HANDLER + + if(DOING_INTERACTION(user, REF(src))) + return + + INVOKE_ASYNC(src, .proc/try_remove_effect, user, tool) + return COMPONENT_BLOCK_TOOL_ATTACK + +/// Signal proc for [COMSIG_CARBON_PRE_HELP_ACT], allowing someone to remove the effect by hand +/datum/status_effect/strandling/proc/on_self_check(mob/living/carbon/source, mob/living/helper) + SIGNAL_HANDLER + + if(DOING_INTERACTION(helper, REF(src))) + return + + INVOKE_ASYNC(src, .proc/try_remove_effect, helper) + return COMPONENT_BLOCK_HELP_ACT + +/** + * Attempts a do_after to remove the effect and stop the strangling. + * + * user - the mob attempting to remove the strangle. Can be the same as the owner. + * tool - the tool the user's using to remove the strange. Can be null. + */ +/datum/status_effect/strandling/proc/try_remove_effect(mob/user, obj/item/tool) + if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) + return + + user.visible_message( + span_notice("[user] attempts to [tool ? "cut":"remove"] the strand from around [owner == user ? "[owner.p_their()]":"[owner]'s"] neck..."), + span_notice("You attempt to [tool ? "cut":"remove"] the strand from around [owner == user ? "your":"[owner]'s"] neck..."), + ) + + // Play a sound if we have a tool + tool?.play_tool_sound(owner) + + // Now try to remove the effect with a doafter. If we have a tool, we'll even remove it 60% faster. + if(!do_mob(user, owner, time_to_remove * (tool ? STRANGLING_TOOL_MULTIPLIER : 1), interaction_key = REF(src))) + to_chat(user, span_warning("You fail to [tool ? "cut":"remove"] the strand from around [owner == user ? "your":"[owner]'s"] neck!")) + return FALSE + + // Play another sound after we're done + tool?.play_tool_sound(owner) + + user.visible_message( + span_notice("[user] successfully [tool ? "cut":"remove"] the strand from around [owner == user ? "[owner.p_their()]":"[owner]'s"] neck."), + span_notice("You successfully [tool ? "cut":"remove"] the strand from around [owner == user ? "your":"[owner]'s"] neck."), + ) + qdel(src) + return TRUE + +/atom/movable/screen/alert/status_effect/strandling + name = "Choking strand" + desc = "Strands of Durathread are wrapped around your neck, preventing you from breathing! Click this icon to remove the strand." + icon_state = "his_grace" + alerttooltipstyle = "hisgrace" + +/atom/movable/screen/alert/status_effect/strandling/Click(location, control, params) + . = ..() + if(!.) + return + + if(!isliving(owner)) + return + + var/datum/status_effect/strandling/strangle_effect = attached_effect + if(!istype(strangle_effect)) + return + + strangle_effect.try_remove_effect(owner) + +#undef STRANGLING_TOOL_MULTIPLIER diff --git a/code/game/objects/items/tools/crowbar.dm b/code/game/objects/items/tools/crowbar.dm index c28186d7c27..1fb50eb1249 100644 --- a/code/game/objects/items/tools/crowbar.dm +++ b/code/game/objects/items/tools/crowbar.dm @@ -140,15 +140,8 @@ user.visible_message(span_notice("[user] cuts [attacked_carbon]'s restraints with [src]!")) qdel(attacked_carbon.handcuffed) return - else if(istype(attacked_carbon) && attacked_carbon.has_status_effect(/datum/status_effect/strandling) && tool_behaviour == TOOL_WIRECUTTER) - user.visible_message(span_notice("[user] attempts to cut the durathread strand from around [attacked_carbon]'s neck.")) - if(do_after(user, 1.5 SECONDS, attacked_carbon)) - user.visible_message(span_notice("[user] succesfully cuts the durathread strand from around [attacked_carbon]'s neck.")) - attacked_carbon.remove_status_effect(/datum/status_effect/strandling) - playsound(loc, usesound, 50, TRUE, -1) - return - else - ..() + + return ..() /obj/item/crowbar/cyborg name = "hydraulic crowbar" diff --git a/code/game/objects/items/tools/wirecutters.dm b/code/game/objects/items/tools/wirecutters.dm index 0d4b13d387a..f8402111f25 100644 --- a/code/game/objects/items/tools/wirecutters.dm +++ b/code/game/objects/items/tools/wirecutters.dm @@ -50,15 +50,8 @@ user.visible_message(span_notice("[user] cuts [attacked_carbon]'s restraints with [src]!")) qdel(attacked_carbon.handcuffed) return - else if(istype(attacked_carbon) && attacked_carbon.has_status_effect(/datum/status_effect/strandling)) - user.visible_message(span_notice("[user] attempts to cut the durathread strand from around [attacked_carbon]'s neck.")) - if(do_after(user, 1.5 SECONDS, attacked_carbon)) - user.visible_message(span_notice("[user] succesfully cuts the durathread strand from around [attacked_carbon]'s neck.")) - attacked_carbon.remove_status_effect(/datum/status_effect/strandling) - playsound(loc, usesound, 50, TRUE, -1) - return - else - ..() + + return ..() /obj/item/wirecutters/suicide_act(mob/user) user.visible_message(span_suicide("[user] is cutting at [user.p_their()] arteries with [src]! It looks like [user.p_theyre()] trying to commit suicide!")) diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 57502ccc01e..e220c26d4e6 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -397,83 +397,88 @@ if(should_stun) Paralyze(60) -/mob/living/carbon/proc/help_shake_act(mob/living/carbon/M) +/mob/living/carbon/proc/help_shake_act(mob/living/carbon/helper) if(on_fire) - to_chat(M, span_warning("You can't put [p_them()] out with just your bare hands!")) + to_chat(helper, span_warning("You can't put [p_them()] out with just your bare hands!")) return - if(M == src && check_self_for_injuries()) + if(SEND_SIGNAL(src, COMSIG_CARBON_PRE_HELP_ACT, helper) & COMPONENT_BLOCK_HELP_ACT) + return + + if(helper == src) + check_self_for_injuries() return if(body_position == LYING_DOWN) if(buckled) - to_chat(M, span_warning("You need to unbuckle [src] first to do that!")) + to_chat(helper, span_warning("You need to unbuckle [src] first to do that!")) return - M.visible_message(span_notice("[M] shakes [src] trying to get [p_them()] up!"), \ - null, span_hear("You hear the rustling of clothes."), DEFAULT_MESSAGE_RANGE, list(M, src)) - to_chat(M, span_notice("You shake [src] trying to pick [p_them()] up!")) - to_chat(src, span_notice("[M] shakes you to get you up!")) - else if(check_zone(M.zone_selected) == BODY_ZONE_HEAD && get_bodypart(BODY_ZONE_HEAD)) //Headpats! - M.visible_message(span_notice("[M] gives [src] a pat on the head to make [p_them()] feel better!"), \ - null, span_hear("You hear a soft patter."), DEFAULT_MESSAGE_RANGE, list(M, src)) - to_chat(M, span_notice("You give [src] a pat on the head to make [p_them()] feel better!")) - to_chat(src, span_notice("[M] gives you a pat on the head to make you feel better! ")) + helper.visible_message(span_notice("[helper] shakes [src] trying to get [p_them()] up!"), \ + null, span_hear("You hear the rustling of clothes."), DEFAULT_MESSAGE_RANGE, list(helper, src)) + to_chat(helper, span_notice("You shake [src] trying to pick [p_them()] up!")) + to_chat(src, span_notice("[helper] shakes you to get you up!")) + else if(check_zone(helper.zone_selected) == BODY_ZONE_HEAD && get_bodypart(BODY_ZONE_HEAD)) //Headpats! + helper.visible_message(span_notice("[helper] gives [src] a pat on the head to make [p_them()] feel better!"), \ + null, span_hear("You hear a soft patter."), DEFAULT_MESSAGE_RANGE, list(helper, src)) + to_chat(helper, span_notice("You give [src] a pat on the head to make [p_them()] feel better!")) + to_chat(src, span_notice("[helper] gives you a pat on the head to make you feel better! ")) if(HAS_TRAIT(src, TRAIT_BADTOUCH)) - to_chat(M, span_warning("[src] looks visibly upset as you pat [p_them()] on the head.")) + to_chat(helper, span_warning("[src] looks visibly upset as you pat [p_them()] on the head.")) - else if ((M.zone_selected == BODY_ZONE_PRECISE_GROIN) && !isnull(src.getorgan(/obj/item/organ/tail))) - M.visible_message(span_notice("[M] pulls on [src]'s tail!"), \ - null, span_hear("You hear a soft patter."), DEFAULT_MESSAGE_RANGE, list(M, src)) - to_chat(M, span_notice("You pull on [src]'s tail!")) - to_chat(src, span_notice("[M] pulls on your tail!")) + else if ((helper.zone_selected == BODY_ZONE_PRECISE_GROIN) && !isnull(src.getorgan(/obj/item/organ/tail))) + helper.visible_message(span_notice("[helper] pulls on [src]'s tail!"), \ + null, span_hear("You hear a soft patter."), DEFAULT_MESSAGE_RANGE, list(helper, src)) + to_chat(helper, span_notice("You pull on [src]'s tail!")) + to_chat(src, span_notice("[helper] pulls on your tail!")) if(HAS_TRAIT(src, TRAIT_BADTOUCH)) //How dare they! - to_chat(M, span_warning("[src] makes a grumbling noise as you pull on [p_their()] tail.")) + to_chat(helper, span_warning("[src] makes a grumbling noise as you pull on [p_their()] tail.")) else SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "tailpulled", /datum/mood_event/tailpulled) else - M.visible_message(span_notice("[M] hugs [src] to make [p_them()] feel better!"), \ - null, span_hear("You hear the rustling of clothes."), DEFAULT_MESSAGE_RANGE, list(M, src)) - to_chat(M, span_notice("You hug [src] to make [p_them()] feel better!")) - to_chat(src, span_notice("[M] hugs you to make you feel better!")) + helper.visible_message(span_notice("[helper] hugs [src] to make [p_them()] feel better!"), \ + null, span_hear("You hear the rustling of clothes."), DEFAULT_MESSAGE_RANGE, list(helper, src)) + to_chat(helper, span_notice("You hug [src] to make [p_them()] feel better!")) + to_chat(src, span_notice("[helper] hugs you to make you feel better!")) // Warm them up with hugs - share_bodytemperature(M) + share_bodytemperature(helper) // No moodlets for people who hate touches if(!HAS_TRAIT(src, TRAIT_BADTOUCH)) - if(bodytemperature > M.bodytemperature) - if(!HAS_TRAIT(M, TRAIT_BADTOUCH)) - SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "hug", /datum/mood_event/warmhug, src) // Hugger got a warm hug (Unless they hate hugs) + if(bodytemperature > helper.bodytemperature) + if(!HAS_TRAIT(helper, TRAIT_BADTOUCH)) + SEND_SIGNAL(helper, COMSIG_ADD_MOOD_EVENT, "hug", /datum/mood_event/warmhug, src) // Hugger got a warm hug (Unless they hate hugs) SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "hug", /datum/mood_event/hug) // Reciver always gets a mood for being hugged else - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "hug", /datum/mood_event/warmhug, M) // You got a warm hug + SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "hug", /datum/mood_event/warmhug, helper) // You got a warm hug // Let people know if they hugged someone really warm or really cold - if(M.bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT) - to_chat(src, span_warning("It feels like [M] is over heating as [M.p_they()] hug[M.p_s()] you.")) - else if(M.bodytemperature < BODYTEMP_COLD_DAMAGE_LIMIT) - to_chat(src, span_warning("It feels like [M] is freezing as [M.p_they()] hug[M.p_s()] you.")) + if(helper.bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT) + to_chat(src, span_warning("It feels like [helper] is over heating as [helper.p_they()] hug[helper.p_s()] you.")) + else if(helper.bodytemperature < BODYTEMP_COLD_DAMAGE_LIMIT) + to_chat(src, span_warning("It feels like [helper] is freezing as [helper.p_they()] hug[helper.p_s()] you.")) if(bodytemperature > BODYTEMP_HEAT_DAMAGE_LIMIT) - to_chat(M, span_warning("It feels like [src] is over heating as you hug [p_them()].")) + to_chat(helper, span_warning("It feels like [src] is over heating as you hug [p_them()].")) else if(bodytemperature < BODYTEMP_COLD_DAMAGE_LIMIT) - to_chat(M, span_warning("It feels like [src] is freezing as you hug [p_them()].")) + to_chat(helper, span_warning("It feels like [src] is freezing as you hug [p_them()].")) - if(HAS_TRAIT(M, TRAIT_FRIENDLY)) - var/datum/component/mood/hugger_mood = M.GetComponent(/datum/component/mood) + if(HAS_TRAIT(helper, TRAIT_FRIENDLY)) + var/datum/component/mood/hugger_mood = helper.GetComponent(/datum/component/mood) if (hugger_mood.sanity >= SANITY_GREAT) new /obj/effect/temp_visual/heart(loc) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "friendly_hug", /datum/mood_event/besthug, M) + SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "friendly_hug", /datum/mood_event/besthug, helper) else if (hugger_mood.sanity >= SANITY_DISTURBED) - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "friendly_hug", /datum/mood_event/betterhug, M) + SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "friendly_hug", /datum/mood_event/betterhug, helper) if(HAS_TRAIT(src, TRAIT_BADTOUCH)) - to_chat(M, span_warning("[src] looks visibly upset as you hug [p_them()].")) + to_chat(helper, span_warning("[src] looks visibly upset as you hug [p_them()].")) + + SEND_SIGNAL(src, COMSIG_CARBON_HELP_ACT, helper) + SEND_SIGNAL(helper, COMSIG_CARBON_HELPED, src) - SEND_SIGNAL(src, COMSIG_CARBON_HUGGED, M) - SEND_SIGNAL(M, COMSIG_CARBON_HUG, M, src) adjust_status_effects_on_shake_up() set_resting(FALSE) if(body_position != STANDING_UP && !resting && !buckled && !HAS_TRAIT(src, TRAIT_FLOORED)) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 98ae8b5aa3e..4d901d61d49 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -693,28 +693,16 @@ . = rand(-1000, 1000) ..() //Called afterwards because getting the mind after getting gibbed is sketchy -/mob/living/carbon/human/help_shake_act(mob/living/carbon/M) - if(!istype(M)) +/mob/living/carbon/human/help_shake_act(mob/living/carbon/helper) + if(!istype(helper)) return - if(src == M) - if(has_status_effect(/datum/status_effect/strandling)) - to_chat(src, span_notice("You attempt to remove the durathread strand from around your neck.")) - if(do_after(src, 3.5 SECONDS, src)) - to_chat(src, span_notice("You succesfuly remove the durathread strand.")) - remove_status_effect(/datum/status_effect/strandling) - return - check_self_for_injuries() - - - else - if(wear_suit) - wear_suit.add_fingerprint(M) - else if(w_uniform) - w_uniform.add_fingerprint(M) - - ..() + if(wear_suit) + wear_suit.add_fingerprint(helper) + else if(w_uniform) + w_uniform.add_fingerprint(helper) + return ..() /mob/living/carbon/human/check_self_for_injuries() if(stat >= UNCONSCIOUS) diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 7fc8c2146f2..8ee5c50f848 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -74,6 +74,8 @@ if(reagents.has_reagent(/datum/reagent/toxin/lexorin, needs_metabolizing = TRUE)) return + SEND_SIGNAL(src, COMSIG_CARBON_PRE_BREATHE) + var/datum/gas_mixture/environment if(loc) environment = loc.return_air() @@ -81,7 +83,7 @@ var/datum/gas_mixture/breath if(!getorganslot(ORGAN_SLOT_BREATHING_TUBE)) - if(health <= HEALTH_THRESHOLD_FULLCRIT || (pulledby && pulledby.grab_state >= GRAB_KILL) || HAS_TRAIT(src, TRAIT_MAGIC_CHOKE) || (lungs && lungs.organ_flags & ORGAN_FAILING)) + if(health <= HEALTH_THRESHOLD_FULLCRIT || (pulledby?.grab_state >= GRAB_KILL) || (lungs?.organ_flags & ORGAN_FAILING)) losebreath++ //You can't breath at all when in critical or when being choked, so you're going to miss a breath else if(health <= crit_threshold) diff --git a/tgstation.dme b/tgstation.dme index a966cdf0d58..0654e5ac996 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1130,6 +1130,7 @@ #include "code\datums\status_effects\debuffs\drunk.dm" #include "code\datums\status_effects\debuffs\fire_stacks.dm" #include "code\datums\status_effects\debuffs\speech_debuffs.dm" +#include "code\datums\status_effects\debuffs\strandling.dm" #include "code\datums\votes\_vote_datum.dm" #include "code\datums\votes\custom_vote.dm" #include "code\datums\votes\map_vote.dm"