diff --git a/code/datums/traits/_quirk.dm b/code/datums/traits/_quirk.dm
index 99fa6e73c5..ce1796346a 100644
--- a/code/datums/traits/_quirk.dm
+++ b/code/datums/traits/_quirk.dm
@@ -14,6 +14,7 @@
/// should we immediately call on_spawn or add a timer to trigger
var/on_spawn_immediate = TRUE
var/mob/living/quirk_holder
+ var/processing_quirk = FALSE
/datum/quirk/New(mob/living/quirk_mob, spawn_effects)
if(!quirk_mob || (human_only && !ishuman(quirk_mob)) || quirk_mob.has_quirk(type))
@@ -25,7 +26,8 @@
quirk_holder.roundstart_quirks += src
if(mob_trait)
ADD_TRAIT(quirk_holder, mob_trait, ROUNDSTART_TRAIT)
- START_PROCESSING(SSquirks, src)
+ if(processing_quirk)
+ START_PROCESSING(SSquirks, src)
add()
if(spawn_effects)
if(on_spawn_immediate)
@@ -35,7 +37,8 @@
addtimer(CALLBACK(src, .proc/post_add), 30)
/datum/quirk/Destroy()
- STOP_PROCESSING(SSquirks, src)
+ if(processing_quirk)
+ STOP_PROCESSING(SSquirks, src)
remove()
if(quirk_holder)
to_chat(quirk_holder, lose_text)
diff --git a/code/datums/traits/good.dm b/code/datums/traits/good.dm
index a0f62a32b8..3bcca275a5 100644
--- a/code/datums/traits/good.dm
+++ b/code/datums/traits/good.dm
@@ -72,6 +72,7 @@
mob_trait = TRAIT_JOLLY
mood_quirk = TRUE
medical_record_text = "Patient demonstrates constant euthymia irregular for environment. It's a bit much, to be honest."
+ processing_quirk = TRUE
/datum/quirk/jolly/on_process()
if(prob(0.05))
diff --git a/code/datums/traits/negative.dm b/code/datums/traits/negative.dm
index 8958226ff4..3d0588a112 100644
--- a/code/datums/traits/negative.dm
+++ b/code/datums/traits/negative.dm
@@ -25,6 +25,7 @@
lose_text = "You no longer feel depressed." //if only it were that easy!
medical_record_text = "Patient has a severe mood disorder, causing them to experience acute episodes of depression."
mood_quirk = TRUE
+ processing_quirk = TRUE
/datum/quirk/depression/on_process()
if(prob(0.05))
@@ -38,6 +39,7 @@
medical_record_text = "Patient demonstrates an unnatural attachment to a family heirloom."
var/obj/item/heirloom
var/where
+ processing_quirk = TRUE
GLOBAL_LIST_EMPTY(family_heirlooms)
@@ -102,6 +104,7 @@ GLOBAL_LIST_EMPTY(family_heirlooms)
gain_text = "You feel smooth."
lose_text = "You feel wrinkled again."
medical_record_text = "Patient has a tumor in their brain that is slowly driving them to brain death."
+ processing_quirk = TRUE
/datum/quirk/brainproblems/on_process()
quirk_holder.adjustOrganLoss(ORGAN_SLOT_BRAIN, 0.2)
@@ -129,25 +132,38 @@ GLOBAL_LIST_EMPTY(family_heirlooms)
value = -1
medical_record_text = "Patient demonstrates a fear of the dark. (Seriously?)"
-/datum/quirk/nyctophobia/on_process()
- var/mob/living/carbon/human/H = quirk_holder
- if(H.dna.species.id in list("shadow", "nightmare"))
- return //we're tied with the dark, so we don't get scared of it; don't cleanse outright to avoid cheese
- var/turf/T = get_turf(quirk_holder)
- var/lums = T.get_lumcount()
- if(lums <= 0.2)
- if(quirk_holder.m_intent == MOVE_INTENT_RUN)
- addtimer(CALLBACK(src, .proc/recheck),2) //0.2 seconds of being in the dark
- SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "nyctophobia", /datum/mood_event/nyctophobia)
- else
- SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "nyctophobia")
+/datum/quirk/nyctophobia/add()
+ RegisterSignal(quirk_holder, COMSIG_MOVABLE_MOVED, .proc/on_holder_moved)
-/datum/quirk/nyctophobia/proc/recheck()
- var/turf/T = get_turf(quirk_holder)
- var/lums = T.get_lumcount()
- if(lums <= 0.2) //check again, did they remain in the dark for 0.2 seconds?
- to_chat(quirk_holder, "Easy, easy, take it slow... you're in the dark...")
+/datum/quirk/nyctophobia/remove()
+ UnregisterSignal(quirk_holder, COMSIG_MOVABLE_MOVED)
+ SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "nyctophobia")
+
+/// Called when the quirk holder moves. Updates the quirk holder's mood.
+/datum/quirk/nyctophobia/proc/on_holder_moved(mob/living/source, atom/old_loc, dir, forced)
+ if(quirk_holder.stat != CONSCIOUS || quirk_holder.IsSleeping() || quirk_holder.IsUnconscious())
+ return
+
+ var/mob/living/carbon/human/human_holder = quirk_holder
+
+ if(human_holder.dna?.species.id in list(SPECIES_SHADOW, SPECIES_NIGHTMARE))
+ return
+
+ if((human_holder.sight & SEE_TURFS) == SEE_TURFS)
+ return
+
+ var/turf/holder_turf = get_turf(quirk_holder)
+
+ var/lums = holder_turf.get_lumcount()
+
+ if(lums > 0.2)
+ SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "nyctophobia")
+ return
+
+ if(quirk_holder.m_intent == MOVE_INTENT_RUN)
+ to_chat(quirk_holder, span_warning("Easy, easy, take it slow... you're in the dark..."))
quirk_holder.toggle_move_intent()
+ SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "nyctophobia", /datum/mood_event/nyctophobia)
/datum/quirk/lightless
name = "Light Sensitivity"
@@ -157,6 +173,36 @@ GLOBAL_LIST_EMPTY(family_heirlooms)
lose_text = "Enlightening."
medical_record_text = "Despite my warnings, the patient refuses turn on the lights, only to end up rolling down a full flight of stairs and into the cellar."
+/datum/quirk/lightless/add()
+ RegisterSignal(quirk_holder, COMSIG_MOVABLE_MOVED, .proc/on_holder_moved)
+
+/datum/quirk/lightless/remove()
+ UnregisterSignal(quirk_holder, COMSIG_MOVABLE_MOVED)
+ SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "brightlight")
+
+/datum/quirk/lightless/proc/on_holder_moved(mob/living/source, atom/old_loc, dir, forced)
+ if(quirk_holder.stat != CONSCIOUS || quirk_holder.IsSleeping() || quirk_holder.IsUnconscious())
+ return
+
+ var/mob/living/carbon/human/human_holder = quirk_holder
+
+ if(human_holder.dna?.species.id in list(SPECIES_SHADOW, SPECIES_NIGHTMARE))
+ return
+
+ if((human_holder.sight & SEE_TURFS) == SEE_TURFS)
+ return
+
+ var/turf/holder_turf = get_turf(quirk_holder)
+
+ var/lums = holder_turf.get_lumcount()
+
+ if(lums < 0.8)
+ SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "brightlight")
+ return
+
+ SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "brightlight", /datum/mood_event/brightlight)
+
+
/datum/quirk/lightless/on_process()
var/turf/T = get_turf(quirk_holder)
var/lums = T.get_lumcount()
@@ -236,6 +282,7 @@ GLOBAL_LIST_EMPTY(family_heirlooms)
gain_text = "..."
lose_text = "You feel in tune with the world again."
medical_record_text = "Patient suffers from acute Reality Dissociation Syndrome and experiences vivid hallucinations."
+ processing_quirk = TRUE
/datum/quirk/insanity/on_process()
if(quirk_holder.reagents.has_reagent(/datum/reagent/toxin/mindbreaker))
@@ -261,6 +308,7 @@ GLOBAL_LIST_EMPTY(family_heirlooms)
lose_text = "You feel easier about talking again." //if only it were that easy!
medical_record_text = "Patient is usually anxious in social encounters and prefers to avoid them."
var/dumb_thing = TRUE
+ processing_quirk = TRUE
/datum/quirk/social_anxiety/add()
RegisterSignal(quirk_holder, COMSIG_MOB_EYECONTACT, .proc/eye_contact)