diff --git a/code/__DEFINES/traits/declarations.dm b/code/__DEFINES/traits/declarations.dm index 98a8df19b7c..a073f5cefab 100644 --- a/code/__DEFINES/traits/declarations.dm +++ b/code/__DEFINES/traits/declarations.dm @@ -826,7 +826,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai /// Trait given to angelic constructs to let them purge cult runes #define TRAIT_ANGELIC "angelic" - +/// Trait given to a dreaming carbon when they are currently doing dreaming stuff +#define TRAIT_DREAMING "currently_dreaming" ///generic atom traits /// Trait from [/datum/element/rust]. Its rusty and should be applying a special overlay to denote this. diff --git a/code/_globalvars/traits/_traits.dm b/code/_globalvars/traits/_traits.dm index 94ef9b1c55e..dc6d21d99e4 100644 --- a/code/_globalvars/traits/_traits.dm +++ b/code/_globalvars/traits/_traits.dm @@ -166,6 +166,7 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_DISSECTED" = TRAIT_DISSECTED, "TRAIT_DONT_WRITE_MEMORY" = TRAIT_DONT_WRITE_MEMORY, "TRAIT_DOUBLE_TAP" = TRAIT_DOUBLE_TAP, + "TRAIT_DREAMING" = TRAIT_DREAMING, "TRAIT_DRINKS_BLOOD" = TRAIT_DRINKS_BLOOD, "TRAIT_DUMB" = TRAIT_DUMB, "TRAIT_DWARF" = TRAIT_DWARF, diff --git a/code/modules/flufftext/Dreaming.dm b/code/modules/flufftext/Dreaming.dm index 06472f84be6..400e024b8b0 100644 --- a/code/modules/flufftext/Dreaming.dm +++ b/code/modules/flufftext/Dreaming.dm @@ -1,3 +1,5 @@ +#define DREAMING_SOURCE "dreaming_source" + /** * Begins the dreaming process on a sleeping carbon. * @@ -6,7 +8,7 @@ */ /mob/living/carbon/proc/handle_dreams() - if(prob(10) && !dreaming) + if(!HAS_TRAIT(src, TRAIT_DREAMING) && prob(10)) dream() /** @@ -22,7 +24,7 @@ var/datum/dream/chosen_dream = pick_weight(GLOB.dreams) - dreaming = TRUE + ADD_TRAIT(src, TRAIT_DREAMING, DREAMING_SOURCE) dream_sequence(chosen_dream.GenerateDream(src), chosen_dream) /** @@ -38,7 +40,7 @@ /mob/living/carbon/proc/dream_sequence(list/dream_fragments, datum/dream/current_dream) if(stat != UNCONSCIOUS || HAS_TRAIT(src, TRAIT_CRITICAL_CONDITION)) - dreaming = FALSE + REMOVE_TRAIT(src, TRAIT_DREAMING, DREAMING_SOURCE) current_dream.OnDreamEnd(src) return var/next_message = dream_fragments[1] @@ -56,7 +58,7 @@ AdjustSleeping(next_wait) addtimer(CALLBACK(src, PROC_REF(dream_sequence), dream_fragments, current_dream), next_wait) else - dreaming = FALSE + REMOVE_TRAIT(src, TRAIT_DREAMING, DREAMING_SOURCE) current_dream.OnDreamEnd(src) //------------------------- @@ -180,3 +182,5 @@ GLOBAL_LIST_INIT(dreams, populate_dream_list()) /datum/dream/hear_something/proc/StopSound(mob/living/carbon/dreamer) SEND_SOUND(dreamer, sound(channel=reserved_sound_channel)) + +#undef DREAMING_SOURCE diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm index e5f43c2e933..a9562686fb6 100644 --- a/code/modules/mob/living/carbon/carbon_defines.dm +++ b/code/modules/mob/living/carbon/carbon_defines.dm @@ -15,8 +15,6 @@ var/list/obj/item/organ/organs = list() ///Same as [above][/mob/living/carbon/var/organs], but stores "slot ID" - "organ" pairs for easy access. var/list/organs_slot = list() - ///How many dream images we have left to send - var/dreaming = 0 ///Whether or not the mob is handcuffed var/obj/item/handcuffed = null