From 88db2f7a26db5adbeac1e647468cd8cde89f6339 Mon Sep 17 00:00:00 2001 From: Fira Date: Sun, 5 Nov 2023 13:47:53 +0000 Subject: [PATCH] daze refactor --- .../living/carbon/human/human_abilities.dm | 2 +- .../human/life/handle_regular_hud_updates.dm | 2 +- code/modules/mob/living/carbon/human/say.dm | 4 ++-- .../mob/living/carbon/xenomorph/Xenomorph.dm | 1 - .../abilities/ravager/ravager_powers.dm | 2 +- .../carbon/xenomorph/abilities/xeno_action.dm | 2 +- .../mob/living/carbon/xenomorph/life.dm | 20 +++++++++---------- .../mob/living/carbon/xenomorph/say.dm | 2 +- code/modules/mob/living/init_signals.dm | 11 ++++++++++ .../modules/mob/living/living_health_procs.dm | 16 +++++++-------- code/modules/mob/mob_defines.dm | 1 - code/modules/projectiles/gun.dm | 4 ++-- .../chemistry_machinery/acid_harness.dm | 2 +- .../chemistry_properties/prop_positive.dm | 2 +- 14 files changed, 40 insertions(+), 31 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_abilities.dm b/code/modules/mob/living/carbon/human/human_abilities.dm index 75aa0de09a06..2af2d738bc5b 100644 --- a/code/modules/mob/living/carbon/human/human_abilities.dm +++ b/code/modules/mob/living/carbon/human/human_abilities.dm @@ -124,7 +124,7 @@ CULT /datum/action/human_action/activable/can_use_action() var/mob/living/carbon/human/H = owner - if(istype(H) && !H.is_mob_incapacitated() && !H.dazed) + if(istype(H) && !H.is_mob_incapacitated() && !HAS_TRAIT(H, TRAIT_DAZED)) return TRUE // Called when the action is clicked on. diff --git a/code/modules/mob/living/carbon/human/life/handle_regular_hud_updates.dm b/code/modules/mob/living/carbon/human/life/handle_regular_hud_updates.dm index 5d706518f5e3..15374aa0be73 100644 --- a/code/modules/mob/living/carbon/human/life/handle_regular_hud_updates.dm +++ b/code/modules/mob/living/carbon/human/life/handle_regular_hud_updates.dm @@ -60,7 +60,7 @@ else clear_fullscreen("blind") - if(dazed) + if(HAS_TRAIT(src, TRAIT_DAZED)) overlay_fullscreen("eye_blurry", /atom/movable/screen/fullscreen/impaired, 5) else clear_fullscreen("eye_blurry") diff --git a/code/modules/mob/living/carbon/human/say.dm b/code/modules/mob/living/carbon/human/say.dm index 28e45dcb2f5e..4fec80653728 100644 --- a/code/modules/mob/living/carbon/human/say.dm +++ b/code/modules/mob/living/carbon/human/say.dm @@ -278,7 +278,7 @@ for it but just ignore it. handled = TRUE var/braindam = getBrainLoss() - if(slurring || stuttering || dazed || braindam >= 60) + if(slurring || stuttering || HAS_TRAIT(src, TRAIT_DAZED) || braindam >= 60) msg_admin_niche("[key_name(src)] stuttered while saying: \"[message]\"") //Messages that get modified by the 4 reasons below have their original message logged too if(slurring) message = slur(message) @@ -288,7 +288,7 @@ for it but just ignore it. message = NewStutter(message) verb = pick("stammers", "stutters") handled = TRUE - if(dazed) + if(HAS_TRAIT(src, TRAIT_DAZED)) message = DazedText(message) verb = pick("mumbles", "babbles") handled = TRUE diff --git a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm index c9fb4e4ee022..a422f72d1586 100644 --- a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm +++ b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm @@ -251,7 +251,6 @@ var/pounce_distance = 0 // Life reduction variables. - var/life_daze_reduction = -1.5 var/life_slow_reduction = -1.5 ////////////////////////////////////////////////////////////////// diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/ravager/ravager_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/ravager/ravager_powers.dm index c61c5096090e..1834e05ac5b1 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/ravager/ravager_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/ravager/ravager_powers.dm @@ -347,7 +347,7 @@ // Negative stat effects if (debilitate) - H.dazed += daze_amount + H.AdjustDaze(daze_amount) apply_cooldown() return ..() diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm b/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm index f0917ef48dc4..f4f2614312fa 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm @@ -71,7 +71,7 @@ if(!owner) return FALSE var/mob/living/carbon/xenomorph/X = owner - if(X && !X.is_mob_incapacitated() && !X.dazed && X.body_position == STANDING_UP && !X.buckled && X.plasma_stored >= plasma_cost) + if(X && !X.is_mob_incapacitated() && !HAS_TRAIT(X, TRAIT_DAZED) && X.body_position == STANDING_UP && !X.buckled && X.plasma_stored >= plasma_cost) return TRUE /datum/action/xeno_action/give_to(mob/living/L) diff --git a/code/modules/mob/living/carbon/xenomorph/life.dm b/code/modules/mob/living/carbon/xenomorph/life.dm index 93b5eef617a0..c8f442c3dd28 100644 --- a/code/modules/mob/living/carbon/xenomorph/life.dm +++ b/code/modules/mob/living/carbon/xenomorph/life.dm @@ -267,11 +267,6 @@ else if(client && !client.adminobs) reset_view(null) - if(dazed) - overlay_fullscreen("dazed", /atom/movable/screen/fullscreen/impaired, 5) - else - clear_fullscreen("dazed") - if(!hud_used) return TRUE @@ -300,6 +295,13 @@ return TRUE +/mob/living/carbon/xenomorph/on_dazed_trait_gain(datum/source) + . = ..() + overlay_fullscreen("dazed", /atom/movable/screen/fullscreen/impaired, 5) +/mob/living/carbon/xenomorph/on_dazed_trait_loss(datum/source) + . = ..() + clear_fullscreen("dazed") + /*Heal 1/70th of your max health in brute per tick. 1 as a bonus, to help smaller pools. Additionally, recovery pheromones mutiply this base healing, up to 2.5 times faster at level 5 Modified via m, to multiply the number of wounds healed. @@ -557,6 +559,9 @@ Make sure their actual health updates immediately.*/ /mob/living/carbon/xenomorph/GetKnockOutDuration(amount) amount *= 2 / 3 return ..() +/mob/living/carbon/xenomorph/GetDazeDuration(amount) + amount *= 2 / 3 + return ..() /mob/living/carbon/xenomorph/proc/handle_interference() if(interference) @@ -567,11 +572,6 @@ Make sure their actual health updates immediately.*/ return interference -/mob/living/carbon/xenomorph/handle_dazed() - if(dazed) - adjust_effect(life_daze_reduction, DAZE, EFFECT_FLAG_LIFE) - return dazed - /mob/living/carbon/xenomorph/handle_slowed() if(slowed) adjust_effect(life_slow_reduction, SLOW, EFFECT_FLAG_LIFE) diff --git a/code/modules/mob/living/carbon/xenomorph/say.dm b/code/modules/mob/living/carbon/xenomorph/say.dm index d1832d10b6fe..47e560b80956 100644 --- a/code/modules/mob/living/carbon/xenomorph/say.dm +++ b/code/modules/mob/living/carbon/xenomorph/say.dm @@ -16,7 +16,7 @@ if(stat == UNCONSCIOUS) return //Unconscious? Nope. - if(dazed > 0) + if(HAS_TRAIT(src, TRAIT_DAZED)) to_chat(src, SPAN_WARNING("You are too dazed to talk.")) return diff --git a/code/modules/mob/living/init_signals.dm b/code/modules/mob/living/init_signals.dm index 06a861cd50e9..75428405068d 100644 --- a/code/modules/mob/living/init_signals.dm +++ b/code/modules/mob/living/init_signals.dm @@ -14,6 +14,9 @@ RegisterSignal(src, list(SIGNAL_ADDTRAIT(TRAIT_UNDENSE), SIGNAL_REMOVETRAIT(TRAIT_UNDENSE)), PROC_REF(undense_changed)) + RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_DAZED), PROC_REF(on_dazed_trait_gain)) + RegisterSignal(src, SIGNAL_REMOVETRAIT(TRAIT_DAZED), PROC_REF(on_dazed_trait_loss)) + /// Called when [TRAIT_KNOCKEDOUT] is added to the mob. /mob/living/proc/on_knockedout_trait_gain(datum/source) SIGNAL_HANDLER @@ -71,6 +74,14 @@ //update_appearance() return +/// Called when [TRAIT_DAZED] is added to the mob. +/mob/living/proc/on_dazed_trait_gain(datum/source) + SIGNAL_HANDLER + +/// Called when [TRAIT_DAZED] is removed from the mob. +/mob/living/proc/on_dazed_trait_loss(datum/source) + SIGNAL_HANDLER + /// Called when [TRAIT_UNDENSE] is gained or lost /mob/living/proc/undense_changed(datum/source) SIGNAL_HANDLER diff --git a/code/modules/mob/living/living_health_procs.dm b/code/modules/mob/living/living_health_procs.dm index 584a82b5ff14..04b92983d9aa 100644 --- a/code/modules/mob/living/living_health_procs.dm +++ b/code/modules/mob/living/living_health_procs.dm @@ -132,9 +132,9 @@ /mob/living/proc/GetDazeDuration(amount) return amount * GLOBAL_STATUS_MULTIPLIER /mob/living/proc/IsDaze() //If we're stunned - return has_status_effect(/datum/status_effect/incapacitating/daze) + return has_status_effect(/datum/status_effect/incapacitating/dazed) /mob/living/proc/AmountDAze() //How many deciseconds remains - var/datum/status_effect/incapacitating/daze/S = IsDaze() + var/datum/status_effect/incapacitating/dazed/S = IsDaze() if(S) return S.get_duration_left() / GLOBAL_STATUS_MULTIPLIER return 0 @@ -142,17 +142,17 @@ if(!(status_flags & CANDAZE)) return amount = GetDazeDuration(amount) - var/datum/status_effect/incapacitating/daze/S = IsDaze() + var/datum/status_effect/incapacitating/dazed/S = IsDaze() if(S) S.update_duration(amount, increment = TRUE) else if(amount > 0) - S = apply_status_effect(/datum/status_effect/incapacitating/daze, amount) + S = apply_status_effect(/datum/status_effect/incapacitating/dazed, amount) return S /mob/living/proc/SetDaze(amount, ignore_canstun = FALSE) //Sets remaining duration if(!(status_flags & CANDAZE)) return amount = GetDazeDuration(amount) - var/datum/status_effect/incapacitating/daze/S = IsDaze() + var/datum/status_effect/incapacitating/dazed/S = IsDaze() if(amount <= 0) if(S) qdel(S) @@ -160,17 +160,17 @@ if(S) S.update_duration(amount) else - S = apply_status_effect(/datum/status_effect/incapacitating/daze, amount) + S = apply_status_effect(/datum/status_effect/incapacitating/dazed, amount) return S /mob/living/proc/AdjustDaze(amount, ignore_canstun = FALSE) //Adds to remaining duration if(!(status_flags & CANDAZE)) return amount = GetStunDuration(amount) - var/datum/status_effect/incapacitating/daze/S = IsDaze() + var/datum/status_effect/incapacitating/dazed/S = IsDaze() if(S) S.adjust_duration(amount) else if(amount > 0) - S = apply_status_effect(/datum/status_effect/incapacitating/daze, amount) + S = apply_status_effect(/datum/status_effect/incapacitating/dazed, amount) return S /mob/living/proc/Slow(amount) diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index a27d8a6c2bad..d590d5e4b7bd 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -66,7 +66,6 @@ var/jitteriness = 0//Carbon var/floatiness = 0 var/losebreath = 0.0//Carbon - var/dazed = 0 var/slowed = 0 // X_SLOW_AMOUNT var/superslowed = 0 // X_SUPERSLOW_AMOUNT var/shakecamera = 0 diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 8040ff4426f2..744c19aea427 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -497,7 +497,7 @@ As sniper rifles have both and weapon mods can change them as well. ..() deals w unwield(user) pull_time = world.time + wield_delay - if(user.dazed) + if(HAS_TRAIT(user, TRAIT_DAZED)) pull_time += 3 guaranteed_delay_time = world.time + WEAPON_GUARANTEED_DELAY @@ -763,7 +763,7 @@ As sniper rifles have both and weapon mods can change them as well. ..() deals w slowdown = initial(slowdown) + aim_slowdown place_offhand(user, initial(name)) wield_time = world.time + wield_delay - if(user.dazed) + if(HAS_TRAIT(user, TRAIT_DAZED)) wield_time += 5 guaranteed_delay_time = world.time + WEAPON_GUARANTEED_DELAY //slower or faster wield delay depending on skill. diff --git a/code/modules/reagents/chemistry_machinery/acid_harness.dm b/code/modules/reagents/chemistry_machinery/acid_harness.dm index 52a1a5f13bd7..b349b3224d1a 100644 --- a/code/modules/reagents/chemistry_machinery/acid_harness.dm +++ b/code/modules/reagents/chemistry_machinery/acid_harness.dm @@ -446,7 +446,7 @@ if(inject_conditions & ACID_SCAN_CONDITION_CONCUSSION && (HAS_TRAIT(src, TRAIT_KNOCKEDOUT) || HAS_TRAIT(src, TRAIT_FLOORED))) condition_scan |= ACID_SCAN_CONDITION_CONCUSSION - if(inject_conditions & ACID_SCAN_CONDITION_INTOXICATION && (user.dazed || user.slowed || user.confused || user.drowsyness || user.dizziness || user.druggy)) + if(inject_conditions & ACID_SCAN_CONDITION_INTOXICATION && (HAS_TRAIT(src, TRAIT_DAZED) || user.slowed || user.confused || user.drowsyness || user.dizziness || user.druggy)) condition_scan |= ACID_SCAN_CONDITION_INTOXICATION //Compare diff --git a/code/modules/reagents/chemistry_properties/prop_positive.dm b/code/modules/reagents/chemistry_properties/prop_positive.dm index 8bf7eadc5d77..a8a11fc299ad 100644 --- a/code/modules/reagents/chemistry_properties/prop_positive.dm +++ b/code/modules/reagents/chemistry_properties/prop_positive.dm @@ -647,7 +647,7 @@ return H.chem_effect_flags |= CHEM_EFFECT_RESIST_NEURO to_chat(M, SPAN_NOTICE("Your skull feels incredibly thick.")) - M.dazed = 0 + M.SetDaze(0) /datum/chem_property/positive/neuroshielding/process_overdose(mob/living/M, potency = 1, delta_time) if(!ishuman(M))