[MIRROR] Drowsiness refactor [MDB IGNORE] (#8836)

* Drowsiness refactor (#62104)

Creates two procs in /mob/status_procs for handling drowsiness changes (with check for negative values), and refactors all code to use these procs instead of assigning values to the mob's drowsiness themselves.

* Drowsiness refactor

* Fixing more stuff in our code

Co-authored-by: thatoneplebeian <67017991+thatoneplebeian@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
This commit is contained in:
SkyratBot
2021-10-15 13:41:35 -04:00
committed by GitHub
co-authored by thatoneplebeian GoldenAlpharex
parent 1fc674a3d8
commit d5cc576efb
24 changed files with 73 additions and 60 deletions
+1 -1
View File
@@ -546,7 +546,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
dizziness = max(dizziness - (restingpwr * delta_time), 0)
if(drowsyness)
drowsyness = max(drowsyness - (restingpwr * delta_time), 0)
adjust_drowsyness(-1 * restingpwr * delta_time)
blur_eyes(1 * delta_time)
if(DT_PROB(2.5, delta_time))
AdjustSleeping(100)
+1 -1
View File
@@ -115,7 +115,7 @@
if(EFFECT_EYE_BLUR)
blur_eyes(effect * hit_percent)
if(EFFECT_DROWSY)
drowsyness = max(drowsyness,(effect * hit_percent))
adjust_drowsyness(effect * hit_percent)
if(EFFECT_JITTER)
if((status_flags & CANSTUN) && !HAS_TRAIT(src, TRAIT_STUNIMMUNE))
jitteriness = max(jitteriness,(effect * hit_percent))
+1 -1
View File
@@ -806,7 +806,7 @@
fire_stacks = 0
set_confusion(0)
dizziness = 0
drowsyness = 0
set_drowsyness(0)
stuttering = 0
slurring = 0
jitteriness = 0
+14 -1
View File
@@ -1,6 +1,6 @@
//Here are the procs used to modify status effects of a mob.
//The effects include: stun, knockdown, unconscious, sleeping, resting, jitteriness, dizziness, ear damage,
//The effects include: stun, knockdown, unconscious, sleeping, resting, jitteriness, dizziness, drowsyness, ear damage,
// eye damage, eye_blind, eye_blurry, druggy, TRAIT_BLIND trait, and TRAIT_NEARSIGHT trait.
///Set the jitter of a mob
@@ -19,6 +19,19 @@
/mob/proc/set_dizziness(amount)
dizziness = max(amount, 0)
/**
* Set drowsyness of a mob to passed value
*/
/mob/proc/set_drowsyness(amount)
drowsyness = max(amount, 0)
/**
* Adds passed value to the drowsyness of a mob
*/
/mob/proc/adjust_drowsyness(amount)
drowsyness = max(drowsyness + amount, 0)
///Blind a mobs eyes by amount
/mob/proc/blind_eyes(amount)
adjust_blindness(amount)