From bdcc41846791ea412e52527faec1268b9de0b39b Mon Sep 17 00:00:00 2001 From: Contrabang <91113370+Contrabang@users.noreply.github.com> Date: Sat, 17 Jun 2023 06:08:59 -0400 Subject: [PATCH] You can now help intent click on people to complete a dap, highfive, or handshake (#21251) * dap moment * lewcc review * lewcc review --- code/datums/status_effects/status_effect.dm | 8 ++ code/modules/mob/living/carbon/carbon.dm | 99 +++++++++++---------- 2 files changed, 60 insertions(+), 47 deletions(-) diff --git a/code/datums/status_effects/status_effect.dm b/code/datums/status_effects/status_effect.dm index 167c802c27c..b137ffe3660 100644 --- a/code/datums/status_effects/status_effect.dm +++ b/code/datums/status_effects/status_effect.dm @@ -146,6 +146,14 @@ if(initial(S1.id) == S.id) return S +/// Returns the effect if the mob calling the proc owns the given status effect, but checks by type. +/mob/living/proc/has_status_effect_type(effect) + if(!length(status_effects)) + return + for(var/datum/status_effect/S in status_effects) + if(istype(S, effect)) + return S + /// Returns a list of effects with matching IDs that the mod owns; use for effects there can be multiple of /mob/living/proc/has_status_effect_list(effect) . = list() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 576dbb6fab8..52adb5079a7 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -219,53 +219,58 @@ M.visible_message("[M] desperately shakes [src] trying to wake [p_them()] up, but sadly there is no reaction!", \ "You shake [src] trying to wake [p_them()], sadly they appear to be too far gone!") return - if(health >= HEALTH_THRESHOLD_CRIT) - if(src == M && ishuman(src)) - check_self_for_injuries() - else - if(player_logged) - M.visible_message("[M] shakes [src], but [p_they()] [p_do()] not respond. Probably suffering from SSD.", \ - "You shake [src], but [p_theyre()] unresponsive. Probably suffering from SSD.") - if(IS_HORIZONTAL(src)) // /vg/: For hugs. This is how update_icon figgers it out, anyway. - N3X15 - add_attack_logs(M, src, "Shaked", ATKLOG_ALL) - if(ishuman(src)) - var/mob/living/carbon/human/H = src - if(H.w_uniform) - H.w_uniform.add_fingerprint(M) - AdjustSleeping(-10 SECONDS) - AdjustParalysis(-6 SECONDS) - AdjustStunned(-6 SECONDS) - AdjustWeakened(-6 SECONDS) - AdjustKnockDown(-6 SECONDS) - adjustStaminaLoss(-10) - resting = FALSE - stand_up() // help them up if possible - playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - if(!player_logged) - M.visible_message( \ - "[M] shakes [src] trying to wake [p_them()] up!",\ - "You shake [src] trying to wake [p_them()] up!",\ - ) - // BEGIN HUGCODE - N3X - else - playsound(get_turf(src), 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - if(M.zone_selected == "head") - M.visible_message(\ - "[M] pats [src] on the head.",\ - "You pat [src] on the head.",\ - ) - else - - M.visible_message(\ - "[M] gives [src] a [pick("hug","warm embrace")].",\ - "You hug [src].",\ - ) - if(ishuman(src)) - var/mob/living/carbon/human/H = src - if(H.wear_suit) - H.wear_suit.add_fingerprint(M) - else if(H.w_uniform) - H.w_uniform.add_fingerprint(M) + if(health < HEALTH_THRESHOLD_CRIT) + return + if(src == M && ishuman(src)) + check_self_for_injuries() + return + if(player_logged) + M.visible_message("[M] shakes [src], but [p_they()] [p_do()] not respond. Probably suffering from SSD.", \ + "You shake [src], but [p_theyre()] unresponsive. Probably suffering from SSD.") + if(IS_HORIZONTAL(src)) // /vg/: For hugs. This is how update_icon figgers it out, anyway. - N3X15 + add_attack_logs(M, src, "Shaked", ATKLOG_ALL) + if(ishuman(src)) + var/mob/living/carbon/human/H = src + if(H.w_uniform) + H.w_uniform.add_fingerprint(M) + AdjustSleeping(-10 SECONDS) + AdjustParalysis(-6 SECONDS) + AdjustStunned(-6 SECONDS) + AdjustWeakened(-6 SECONDS) + AdjustKnockDown(-6 SECONDS) + adjustStaminaLoss(-10) + resting = FALSE + stand_up() // help them up if possible + playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) + if(!player_logged) + M.visible_message( \ + "[M] shakes [src] trying to wake [p_them()] up!",\ + "You shake [src] trying to wake [p_them()] up!",\ + ) + return + // BEGIN HUGCODE - N3X + playsound(get_turf(src), 'sound/weapons/thudswoosh.ogg', 50, 1, -1) + if(M.zone_selected == "head") + M.visible_message(\ + "[M] pats [src] on the head.",\ + "You pat [src] on the head.",\ + ) + return + // If it has any of the highfive statuses, dap, handshake, etc + var/datum/status_effect/effect = has_status_effect_type(STATUS_EFFECT_HIGHFIVE) + if(effect) + M.apply_status_effect(effect.type) + return + M.visible_message(\ + "[M] gives [src] a [pick("hug","warm embrace")].",\ + "You hug [src].",\ + ) + if(ishuman(src)) + var/mob/living/carbon/human/H = src + if(H.wear_suit) + H.wear_suit.add_fingerprint(M) + else if(H.w_uniform) + H.w_uniform.add_fingerprint(M) /** * Handles patting out a fire on someone.