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.
This commit is contained in:
MrMelbert
2022-05-09 09:58:00 -07:00
committed by GitHub
parent a0cac12e74
commit a020e28305
13 changed files with 188 additions and 129 deletions
@@ -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))
@@ -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)
+3 -1
View File
@@ -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)