diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 75b21d723884..c89e03b9fe46 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -153,6 +153,9 @@ /// Prevents voluntary standing or staying up on its own. #define TRAIT_FLOORED "floored" #define TRAIT_INCAPACITATED "incapacitated" +/// Disoriented. Unable to talk, and unable to use skills as Xeno +#define TRAIT_DAZED "dazed" + // HIVE TRAITS /// If the Hive is a Xenonid Hive @@ -291,6 +294,7 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_KNOCKEDOUT" = TRAIT_KNOCKEDOUT, "TRAIT_IMMOBILIZED" = TRAIT_IMMOBILIZED, "TRAIT_FLOORED" = TRAIT_FLOORED, + "TRAIT_DAZED" = TRAIT_DAZED, "TRAIT_UNDENSE" = TRAIT_UNDENSE, "TRAIT_YAUTJA_TECH" = TRAIT_YAUTJA_TECH, "TRAIT_SUPER_STRONG" = TRAIT_SUPER_STRONG, diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 80e21e8da168..a87896efc790 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1131,7 +1131,7 @@ var/global/image/action_purple_power_up ) . = FALSE break - if(user_flags & INTERRUPT_DAZED && busy_user.dazed) + if(user_flags & INTERRUPT_DAZED && HAS_TRAIT(busy_user, TRAIT_DAZED)) . = FALSE break if(user_flags & INTERRUPT_EMOTE && !busy_user.flags_emote) diff --git a/code/datums/status_effects/debuffs/debuffs.dm b/code/datums/status_effects/debuffs/debuffs.dm index f74c6d0ebd29..be371e2c1694 100644 --- a/code/datums/status_effects/debuffs/debuffs.dm +++ b/code/datums/status_effects/debuffs/debuffs.dm @@ -106,3 +106,19 @@ name = "Unconscious" desc = "You've been knocked out." icon_state = ALERT_KNOCKEDOUT + +/// DAZED: +/// This prevents talking as human or using abilities as Xenos, mainly +/datum/status_effect/incapacitating/dazed + id = "dazed" + needs_update_stat = TRUE + +/datum/status_effect/incapacitating/dazed/on_apply() + . = ..() + if(!.) + return + ADD_TRAIT(owner, TRAIT_DAZED, TRAIT_STATUS_EFFECT(id)) + +/datum/status_effect/incapacitating/dazed/on_remove() + REMOVE_TRAIT(owner, TRAIT_DAZED, TRAIT_STATUS_EFFECT(id)) + return ..() diff --git a/code/modules/mob/living/carbon/human/life/life_helpers.dm b/code/modules/mob/living/carbon/human/life/life_helpers.dm index 0f5e611405e2..7326e302848f 100644 --- a/code/modules/mob/living/carbon/human/life/life_helpers.dm +++ b/code/modules/mob/living/carbon/human/life/life_helpers.dm @@ -197,16 +197,6 @@ speech_problem_flag = TRUE return slurring -/mob/living/carbon/human/handle_dazed() - if(dazed) - var/skill_resistance = skills ? (skills.get_skill_level(SKILL_ENDURANCE)-1)*0.1 : 0 - - var/final_reduction = skill_resistance + 1 - adjust_effect(-final_reduction, DAZE, EFFECT_FLAG_LIFE) - if(dazed) - speech_problem_flag = TRUE - return dazed - /mob/living/carbon/human/handle_stuttering() if(..()) speech_problem_flag = TRUE @@ -232,6 +222,13 @@ var/final_reduction = (1 - skill_resistance * 0.02) / species.knock_out_reduction return . * final_reduction +/mob/living/carbon/human/GetDazeDuration(amount) + . = ..() + var/skill_resistance = skills ? (skills.get_skill_level(SKILL_ENDURANCE)-1)*0.08 : 0 + var/final_reduction = (1 - skill_resistance) + return . * final_reduction + + /mob/living/carbon/human/proc/handle_revive() SEND_SIGNAL(src, COMSIG_HUMAN_REVIVED) track_revive(job) diff --git a/code/modules/mob/living/living_health_procs.dm b/code/modules/mob/living/living_health_procs.dm index 63b37aed369e..584a82b5ff14 100644 --- a/code/modules/mob/living/living_health_procs.dm +++ b/code/modules/mob/living/living_health_procs.dm @@ -127,20 +127,51 @@ S = apply_status_effect(/datum/status_effect/incapacitating/stun, amount) return S +/* DAZE (Light incapacitation) */ +/// Overridable handler to adjust the numerical value of status effects. Expand as needed +/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) +/mob/living/proc/AmountDAze() //How many deciseconds remains + var/datum/status_effect/incapacitating/daze/S = IsDaze() + if(S) + return S.get_duration_left() / GLOBAL_STATUS_MULTIPLIER + return 0 /mob/living/proc/Daze(amount) - if(status_flags & CANDAZE) - dazed = max(max(dazed,amount),0) - return - -/mob/living/proc/SetDaze(amount) - if(status_flags & CANDAZE) - dazed = max(amount,0) - return - -/mob/living/proc/AdjustDaze(amount) - if(status_flags & CANDAZE) - dazed = max(dazed + amount,0) - return + if(!(status_flags & CANDAZE)) + return + amount = GetDazeDuration(amount) + var/datum/status_effect/incapacitating/daze/S = IsDaze() + if(S) + S.update_duration(amount, increment = TRUE) + else if(amount > 0) + S = apply_status_effect(/datum/status_effect/incapacitating/daze, 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() + if(amount <= 0) + if(S) + qdel(S) + else + if(S) + S.update_duration(amount) + else + S = apply_status_effect(/datum/status_effect/incapacitating/daze, 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() + if(S) + S.adjust_duration(amount) + else if(amount > 0) + S = apply_status_effect(/datum/status_effect/incapacitating/daze, amount) + return S /mob/living/proc/Slow(amount) if(status_flags & CANSLOW) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 5501f7547fe5..6155ff482679 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -846,7 +846,6 @@ note dizziness decrements automatically in the mob's Life() proc. handle_silent() handle_drugged() handle_slurring() - handle_dazed() handle_slowed() handle_superslowed() @@ -855,11 +854,6 @@ note dizziness decrements automatically in the mob's Life() proc. adjust_effect(-1, STUN) return stunned -/mob/living/proc/handle_dazed() - if(dazed) - adjust_effect(-1, DAZE) - return dazed - /mob/living/proc/handle_slowed() if(slowed) adjust_effect(-1, SLOW)