From 5b2d211da919ecdc4b1a0f93a283ea9f8e303f5b Mon Sep 17 00:00:00 2001
From: Taurtura <141481662+Taurtura@users.noreply.github.com>
Date: Sat, 11 Jan 2025 05:03:27 +0100
Subject: [PATCH] [PTBF] Adds a new hallucination, Blind Rushers! (#27717)
* adds the hallucination
* makes sure the hallucination looks at the player correctly
* spellin fix
* oh yeah this is much better- wait why are there only two of you now
* A bunch of Gatcha's and DGamer's reviews
* remove is_text stuff because it's not needed at all
* latest reviews + hallucination list reviews
* Update code/modules/hallucinations/effects/blind_rush_hallucination.dm
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Taurtura <141481662+Taurtura@users.noreply.github.com>
* Update code/modules/hallucinations/effects/blind_rush_hallucination.dm
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Taurtura <141481662+Taurtura@users.noreply.github.com>
* adds last hallucination to list
* Update code/modules/hallucinations/effects/blind_rush_hallucination.dm
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Taurtura <141481662+Taurtura@users.noreply.github.com>
---------
Signed-off-by: Taurtura <141481662+Taurtura@users.noreply.github.com>
Signed-off-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
---
.../effects/blind_rush_hallucination.dm | 68 +++++++++++++++++++
code/modules/hallucinations/hallucinations.dm | 4 ++
paradise.dme | 1 +
3 files changed, 73 insertions(+)
create mode 100644 code/modules/hallucinations/effects/blind_rush_hallucination.dm
diff --git a/code/modules/hallucinations/effects/blind_rush_hallucination.dm b/code/modules/hallucinations/effects/blind_rush_hallucination.dm
new file mode 100644
index 00000000000..88676e30316
--- /dev/null
+++ b/code/modules/hallucinations/effects/blind_rush_hallucination.dm
@@ -0,0 +1,68 @@
+/**
+ * # Hallucination - Blind Rush
+ *
+ * Makes target blind and causes them to see semi-transparent humanoids running at them.
+ */
+/datum/hallucination_manager/blind_rush
+ initial_hallucination = /obj/effect/hallucination/no_delete/blind_rusher
+ trigger_time = 3.4 SECONDS //total length of the hallucination is a little more than ten seconds
+
+/datum/hallucination_manager/blind_rush/get_spawn_location()
+ var/list/turfs = orange(13, owner.loc)
+ return pick(turfs)
+
+/datum/hallucination_manager/blind_rush/on_spawn()
+ owner.playsound_local(get_turf(src), 'sound/spookoween/ghost_whisper.ogg', 30, TRUE)
+ owner.become_blind("hallucination")
+ to_chat(owner, "Who turned off the light?", MESSAGE_TYPE_INFO)
+
+/datum/hallucination_manager/blind_rush/on_trigger()
+ var/turf/spawn_location = get_spawn_location() //we need a new spawn location incase the player moved
+ hallucination_list += new /obj/effect/hallucination/no_delete/blind_rusher(spawn_location, owner)
+ to_chat(owner, "They're here.", MESSAGE_TYPE_INFO)
+ trigger_timer = addtimer(CALLBACK(src, PROC_REF(on_second_trigger)), trigger_time, TIMER_DELETE_ME)
+
+/datum/hallucination_manager/blind_rush/proc/on_second_trigger()
+ var/turf/spawn_location = get_spawn_location()
+ hallucination_list += new /obj/effect/hallucination/no_delete/blind_rusher(spawn_location, owner)
+ owner.Confused(9 SECONDS)
+ owner.Jitter(9 SECONDS)
+ to_chat(owner, "Run!", MESSAGE_TYPE_INFO)
+ trigger_timer = addtimer(CALLBACK(src, PROC_REF(on_last_trigger)), trigger_time, TIMER_DELETE_ME)
+
+/datum/hallucination_manager/blind_rush/proc/on_last_trigger()
+ owner.emote("collapse")
+ owner.cure_blind("hallucination")
+ qdel(src)
+
+/obj/effect/hallucination/no_delete/blind_rusher
+ name = "Unknown"
+ alpha = 100
+ hallucination_plane = 25 //to make sure we render the hallucination above the blindness layer.
+ hallucination_layer = 25
+ hallucination_icon = 'icons/mob/simple_human.dmi'
+ hallucination_icon_state = ("faceless")
+ hallucination_override = TRUE
+ var/min_distance = 0
+ var/rush_time = 2 DECISECONDS
+ var/rush_timer = null
+
+/obj/effect/hallucination/no_delete/blind_rusher/Initialize(mapload, mob/living/carbon/target)
+ rush_timer = addtimer(CALLBACK(src, PROC_REF(rush)), rush_time, TIMER_LOOP | TIMER_STOPPABLE)
+ if(prob(50))
+ hallucination_icon = 'icons/mob/simple_human.dmi'
+ hallucination_icon_state = pick("clown", "skeleton_warden", "skeleton_warden_alt")
+ return ..()
+
+/obj/effect/hallucination/no_delete/blind_rusher/Destroy()
+ deltimer(rush_timer)
+ return ..()
+
+/obj/effect/hallucination/no_delete/blind_rusher/proc/rush()
+ if(get_dist(src, target) > min_distance)
+ var/direction = get_dir(src, target) //making sure the hallucination is facing the player correctly.
+ forceMove(get_step(src, direction)) //forceMove to go through walls and other dense turfs.
+ dir = direction
+ else
+ target.playsound_local(get_turf(src), 'sound/misc/demon_attack1.ogg', 25, TRUE)
+ qdel(src)
diff --git a/code/modules/hallucinations/hallucinations.dm b/code/modules/hallucinations/hallucinations.dm
index 5bb4e8a5f0a..ddf8e15cd1c 100644
--- a/code/modules/hallucinations/hallucinations.dm
+++ b/code/modules/hallucinations/hallucinations.dm
@@ -32,6 +32,7 @@ GLOBAL_LIST_INIT(hallucinations, list(
/obj/effect/hallucination/fake_grenade/spawner = 10,
/obj/effect/hallucination/terror_infestation = 10,
/obj/effect/hallucination/loose_energy_ball = 10,
+ /datum/hallucination_manager/blind_rush = 1,
/datum/hallucination_manager/xeno_pounce = 10,
/datum/hallucination_manager/waves = 2,
/obj/effect/hallucination/blob = 10,
@@ -56,6 +57,8 @@ GLOBAL_LIST_INIT(hallucinations, list(
var/hallucination_override = FALSE
/// Hallucination layer.
var/hallucination_layer = MOB_LAYER
+ ///Hallucination plane.
+ var/hallucination_plane = AREA_PLANE
/// The mob that sees this hallucination.
var/mob/living/carbon/target = null
/// Lazy list of images created as part of the hallucination. Cleared on destruction.
@@ -73,6 +76,7 @@ GLOBAL_LIST_INIT(hallucinations, list(
var/image/I = image(hallucination_icon, hallucination_override ? src : get_turf(src), hallucination_icon_state)
I.override = hallucination_override
I.layer = hallucination_layer
+ I.plane = hallucination_plane
add_icon(I)
// Lifetime
if(islist(duration))
diff --git a/paradise.dme b/paradise.dme
index 18d4c596688..2959029f31e 100644
--- a/paradise.dme
+++ b/paradise.dme
@@ -1993,6 +1993,7 @@
#include "code\modules\games\unum.dm"
#include "code\modules\hallucinations\hallucination_manager.dm"
#include "code\modules\hallucinations\hallucinations.dm"
+#include "code\modules\hallucinations\effects\blind_rush_hallucination.dm"
#include "code\modules\hallucinations\effects\common.dm"
#include "code\modules\hallucinations\effects\grenades.dm"
#include "code\modules\hallucinations\effects\major.dm"