From 1ca0d91ae1e3033da7baab6dab9e2d3d14ad1f51 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 15 Jan 2025 14:34:13 -0500 Subject: [PATCH] add a fade out and in --- .../hallucinations/effects/backrooms.dm | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/code/modules/hallucinations/effects/backrooms.dm b/code/modules/hallucinations/effects/backrooms.dm index 3c512adf1d1d..ef34b3957fc8 100644 --- a/code/modules/hallucinations/effects/backrooms.dm +++ b/code/modules/hallucinations/effects/backrooms.dm @@ -7,36 +7,50 @@ GLOBAL_VAR_INIT(backrooms_occupied, FALSE) */ /datum/hallucination_manager/backrooms + // this is the total length of the hallucination, if it's too short it cuts off the end + trigger_time = 14 SECONDS + // Human that will see the hallucination + var/mob/living/carbon/human/human_owner // Item that will copy the owner's visible contents var/obj/item/clone_base -/datum/hallucination_manager/backrooms/Destroy(force) - if(!ishuman(owner)) // not sure how we got here but alright - return - var/mob/living/carbon/human/human_owner = owner - - GLOB.backrooms_occupied = FALSE - UnregisterSignal(human_owner, COMSIG_MOVABLE_MOVED) - human_owner.reset_perspective(human_owner) - QDEL_NULL(clone_base) - return ..() - /datum/hallucination_manager/backrooms/on_spawn() if(!ishuman(owner)) return - var/mob/living/carbon/human/human_owner = owner - + human_owner = owner // One person at a time in the backrooms, no backroom brawls allowed. if(GLOB.backrooms_occupied) return GLOB.backrooms_occupied = TRUE + fade_out_trigger() - var/obj/spawn_location = pick(GLOB.backroomswarp) +/datum/hallucination_manager/backrooms/proc/fade_out_trigger() + human_owner.overlay_fullscreen("sleepblind", /atom/movable/screen/fullscreen/center/blind/sleeping, animated = 1 SECONDS) + trigger_timer = addtimer(CALLBACK(src, PROC_REF(do_hallucination_trigger)), 1 SECONDS, TIMER_STOPPABLE) +/datum/hallucination_manager/backrooms/proc/do_hallucination_trigger() + human_owner.clear_fullscreen("sleepblind") RegisterSignal(human_owner, COMSIG_MOVABLE_MOVED, PROC_REF(follow_movement)) + var/obj/spawn_location = pick(GLOB.backroomswarp) clone_base = new(spawn_location) clone_base.vis_contents += human_owner human_owner.reset_perspective(clone_base) + trigger_timer = addtimer(CALLBACK(src, PROC_REF(fade_in_trigger)), 12 SECONDS, TIMER_STOPPABLE) + +/datum/hallucination_manager/backrooms/proc/fade_in_trigger() + human_owner.overlay_fullscreen("sleepblind", /atom/movable/screen/fullscreen/center/blind/sleeping, animated = 1 SECONDS) + trigger_timer = addtimer(CALLBACK(src, PROC_REF(end_fade_trigger)), 1 SECONDS, TIMER_STOPPABLE) + +/datum/hallucination_manager/backrooms/proc/end_fade_trigger() + human_owner.clear_fullscreen("sleepblind") + +/datum/hallucination_manager/backrooms/Destroy(force) + GLOB.backrooms_occupied = FALSE + UnregisterSignal(human_owner, COMSIG_MOVABLE_MOVED) + human_owner.reset_perspective(human_owner) + human_owner = null + QDEL_NULL(clone_base) + return ..() /datum/hallucination_manager/backrooms/proc/follow_movement(source, atom/old_loc, dir, forced) // signal is called above in on_spawn so that whenever our human moves, we also move the clone