Skip to content

Commit

Permalink
daze refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
fira committed Nov 5, 2023
1 parent 93e4fcd commit 88db2f7
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 31 deletions.
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/human_abilities.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/human/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/living/carbon/xenomorph/Xenomorph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@
var/pounce_distance = 0

// Life reduction variables.
var/life_daze_reduction = -1.5
var/life_slow_reduction = -1.5

//////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@

// Negative stat effects
if (debilitate)
H.dazed += daze_amount
H.AdjustDaze(daze_amount)

apply_cooldown()
return ..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 10 additions & 10 deletions code/modules/mob/living/carbon/xenomorph/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/xenomorph/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions code/modules/mob/living/init_signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions code/modules/mob/living/living_health_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -132,45 +132,45 @@
/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
/mob/living/proc/Daze(amount)
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)
else
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)
Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry_machinery/acid_harness.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 88db2f7

Please sign in to comment.