diff --git a/code/controllers/subsystem/processing/quirks.dm b/code/controllers/subsystem/processing/quirks.dm index 1708f6a93d2..20b02be8b80 100644 --- a/code/controllers/subsystem/processing/quirks.dm +++ b/code/controllers/subsystem/processing/quirks.dm @@ -34,7 +34,8 @@ PROCESSING_SUBSYSTEM_DEF(quirks) list("Mute", "Soft-Spoken"), list("Stormtrooper Aim", "Big Hands"), list("Bilingual", "Foreigner"), - list("Spacer", "Paraplegic") + list("Spacer", "Paraplegic"), + list("Photophobia", "Nyctophobia"), ) /datum/controller/subsystem/processing/quirks/Initialize() diff --git a/code/datums/mood_events/generic_negative_events.dm b/code/datums/mood_events/generic_negative_events.dm index 1fd94e5dbc8..27e2645efd3 100644 --- a/code/datums/mood_events/generic_negative_events.dm +++ b/code/datums/mood_events/generic_negative_events.dm @@ -128,6 +128,10 @@ mood_change = -3 timeout = 5 MINUTES +/datum/mood_event/photophobia + description = "The lights are too bright..." + mood_change = -3 + /datum/mood_event/nyctophobia description = "It sure is dark around here..." mood_change = -3 diff --git a/code/datums/quirks/negative_quirks/negative_quirks.dm b/code/datums/quirks/negative_quirks/negative_quirks.dm index ea0cbba3fae..9f7a6c87bd3 100644 --- a/code/datums/quirks/negative_quirks/negative_quirks.dm +++ b/code/datums/quirks/negative_quirks/negative_quirks.dm @@ -1,5 +1,4 @@ //predominantly negative traits - /datum/quirk/badback name = "Bad Back" desc = "Thanks to your poor posture, backpacks and other bags never sit right on your back. More evenly weighted objects are fine, though." @@ -367,6 +366,7 @@ hardcore_value = 3 mail_goodies = list(/obj/item/reagent_containers/cup/glass/waterbottle) + /datum/quirk/item_quirk/nearsighted name = "Nearsighted" desc = "You are nearsighted without prescription glasses, but spawn with a pair." @@ -445,6 +445,78 @@ quirk_holder.toggle_move_intent() quirk_holder.add_mood_event("nyctophobia", /datum/mood_event/nyctophobia) +#define MOOD_CATEGORY_PHOTOPHOBIA "photophobia" + +/datum/quirk/photophobia + name = "Photophobia" + desc = "Bright lights seem to bother you more than others. Maybe it's a medical condition." + icon = FA_ICON_ARROWS_TO_EYE + value = -4 + gain_text = span_danger("The safety of light feels off...") + lose_text = span_notice("Enlightening.") + medical_record_text = "Patient has acute phobia of light, and insists it is physically harmful." + hardcore_value = 4 + mail_goodies = list( + /obj/item/flashlight/flashdark, + /obj/item/food/grown/mushroom/glowshroom/shadowshroom, + /obj/item/skillchip/light_remover, + ) + +/datum/quirk/photophobia/add(client/client_source) + RegisterSignal(quirk_holder, COMSIG_CARBON_GAIN_ORGAN, PROC_REF(check_eyes)) + RegisterSignal(quirk_holder, COMSIG_CARBON_LOSE_ORGAN, PROC_REF(restore_eyes)) + RegisterSignal(quirk_holder, COMSIG_MOVABLE_MOVED, PROC_REF(on_holder_moved)) + update_eyes(quirk_holder.get_organ_slot(ORGAN_SLOT_EYES)) + + UnregisterSignal(quirk_holder, list( + COMSIG_CARBON_GAIN_ORGAN, + COMSIG_CARBON_LOSE_ORGAN, + COMSIG_MOVABLE_MOVED,)) + quirk_holder.clear_mood_event(MOOD_CATEGORY_PHOTOPHOBIA) + +/datum/quirk/photophobia/proc/check_eyes(obj/item/organ/internal/eyes/sensitive_eyes) + SIGNAL_HANDLER + if(!istype(sensitive_eyes)) + return + update_eyes(sensitive_eyes) + +/datum/quirk/photophobia/proc/update_eyes(obj/item/organ/internal/eyes/target_eyes) + if(!istype(target_eyes)) + return + target_eyes.flash_protect = max(target_eyes.flash_protect - 1, FLASH_PROTECTION_HYPER_SENSITIVE) + +/datum/quirk/photophobia/proc/restore_eyes(obj/item/organ/internal/eyes/normal_eyes) + SIGNAL_HANDLER + if(!istype(normal_eyes)) + return + normal_eyes.flash_protect = initial(normal_eyes.flash_protect) + +/datum/quirk/photophobia/proc/on_holder_moved(mob/living/source, atom/old_loc, dir, forced) + SIGNAL_HANDLER + + if(quirk_holder.stat != CONSCIOUS || quirk_holder.IsSleeping() || quirk_holder.IsUnconscious()) + return + + if(HAS_TRAIT(quirk_holder, TRAIT_FEARLESS)) + return + + var/mob/living/carbon/human/human_holder = quirk_holder + + if(human_holder.sight & SEE_TURFS) + return + + var/turf/holder_turf = get_turf(quirk_holder) + + var/lums = holder_turf.get_lumcount() + + var/eye_protection = quirk_holder.get_eye_protection() + if(lums < LIGHTING_TILE_IS_DARK || eye_protection >= FLASH_PROTECTION_NONE) + quirk_holder.clear_mood_event(MOOD_CATEGORY_PHOTOPHOBIA) + return + quirk_holder.add_mood_event(MOOD_CATEGORY_PHOTOPHOBIA, /datum/mood_event/photophobia) + + #undef MOOD_CATEGORY_PHOTOPHOBIA + /datum/quirk/softspoken name = "Soft-Spoken" desc = "You are soft-spoken, and your voice is hard to hear."