mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-01 13:12:23 +00:00
* add backrooms hallucination * mapmerge * fix some backrooms issues and add some error handling stuff * change backrooms carpet * remove code that isn't doing anything * tick new backrooms file * try a new method with movement * don't smooth corners * fix red carpet hiding under backrooms carpet * fix multiple turfs * accidentally removed important code tracking items, oops * implement new solution to the backrooms clone thing * hmm so that's what the icon does * indentation machine broke * remove the tucked away spawn locations * add comment for follow_movement * revert oversight (the bar can keep its bevvies) * put the thing back in that I wasn't supposed to remove * Update code/modules/hallucinations/effects/backrooms.dm Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: Paul <90473506+pwbokie@users.noreply.github.com> * Update code/modules/hallucinations/effects/backrooms.dm Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: Paul <90473506+pwbokie@users.noreply.github.com> * fix missing comma * code improvement tweaks from DLG * add a fade out and in --------- Signed-off-by: Paul <90473506+pwbokie@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
60 lines
2.2 KiB
Plaintext
60 lines
2.2 KiB
Plaintext
/*
|
|
* Hallucination manager
|
|
* Automatically spawns a hallucination effect according to `get_spawn_location` and `initial_hallucination`
|
|
* By default invokes a 10 second trigger. By default that trigger will delete the manager and thus the hallucination
|
|
*/
|
|
|
|
/datum/hallucination_manager
|
|
/// Person on who this hallucination is
|
|
var/mob/living/owner
|
|
/// Reference to the timer that will do the first trigger
|
|
var/trigger_timer
|
|
/// How fast do we need to start our first trigger
|
|
var/trigger_time = 10 SECONDS
|
|
/// A list with all of our hallucinations
|
|
var/list/hallucination_list = list()
|
|
/// A list with any images that we made separately from our hallucinations
|
|
var/list/images = list()
|
|
/// The first hallucination that we spawn. Also doubles as a reference to our hallucination
|
|
var/obj/effect/hallucination/no_delete/initial_hallucination
|
|
|
|
// `ignore_this_argument` is here because there are still old hallucinations which require a location passed
|
|
/datum/hallucination_manager/New(turf/ignore_this_argument, mob/living/hallucinator)
|
|
. = ..()
|
|
owner = hallucinator
|
|
if(QDELETED(owner))
|
|
qdel(src)
|
|
return
|
|
RegisterSignal(owner, COMSIG_PARENT_QDELETING, PROC_REF(signal_qdel))
|
|
spawn_hallucination()
|
|
|
|
/datum/hallucination_manager/Destroy(force)
|
|
. = ..()
|
|
owner = null
|
|
QDEL_NULL(hallucination_list)
|
|
QDEL_NULL(images)
|
|
|
|
/datum/hallucination_manager/proc/spawn_hallucination()
|
|
var/turf/spawn_location = get_spawn_location()
|
|
if(!spawn_location)
|
|
return
|
|
if(initial_hallucination)
|
|
initial_hallucination = new initial_hallucination(spawn_location, owner)
|
|
hallucination_list |= initial_hallucination
|
|
on_spawn()
|
|
trigger_timer = addtimer(CALLBACK(src, PROC_REF(on_trigger)), trigger_time, TIMER_DELETE_ME)
|
|
|
|
/// Returns a turf on where to spawn a hallucination
|
|
/datum/hallucination_manager/proc/get_spawn_location()
|
|
var/list/turfs = view(5, owner)
|
|
return pick(turfs)
|
|
|
|
/// The proc that runs when our hallucination is first spawned
|
|
/datum/hallucination_manager/proc/on_spawn()
|
|
return
|
|
|
|
/// Trigger. By default will delete the manager
|
|
/datum/hallucination_manager/proc/on_trigger()
|
|
// If you want to have more behaviour after this callback, define a new proc on your own manager
|
|
qdel(src)
|