From 57c3b9b960d8ca8a56f4371f37b7c511a340bb48 Mon Sep 17 00:00:00 2001
From: MisterMovie <44909173+Accinator50@users.noreply.github.com>
Date: Fri, 10 Jan 2025 03:33:46 +0100
Subject: [PATCH] [PTBF] Adds custom hallucination descriptions (#27651)
* adds custom hallucination descriptions
* removes useless code comments
* fixes indentation
* a couple of fixes
* Fixes pronoun helper
* more code fixes
* forgot something...
* updates a sentence
* hallucination can actually roll now, increases probability
* fixes indentation
* removes empty line
* resolves merge conflict
---------
Signed-off-by: MisterMovie <44909173+Accinator50@users.noreply.github.com>
---
code/__HELPERS/trait_helpers.dm | 1 +
code/_globalvars/traits.dm | 4 ++-
code/modules/hallucinations/effects/minor.dm | 18 ++++++++++++
code/modules/hallucinations/hallucinations.dm | 1 +
code/modules/mob/living/carbon/examine.dm | 28 +++++++++++++++++++
5 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/code/__HELPERS/trait_helpers.dm b/code/__HELPERS/trait_helpers.dm
index 095e02a0fa8..2b3496855f5 100644
--- a/code/__HELPERS/trait_helpers.dm
+++ b/code/__HELPERS/trait_helpers.dm
@@ -252,6 +252,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_RECENTLY_BLOCKED_MAGIC "recently_blocked_magic"
#define TRAIT_UNKNOWN "unknown" // The person with this trait always appears as 'unknown'.
#define TRAIT_CRYO_DESPAWNING "cryo_despawning" // dont adminbus this please
+#define TRAIT_EXAMINE_HALLUCINATING "examine_hallucinating"
//***** MIND TRAITS *****/
#define TRAIT_HOLY "is_holy" // The mob is holy in regards to religion
diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm
index e0be5bf3b90..7ce28f4c915 100644
--- a/code/_globalvars/traits.dm
+++ b/code/_globalvars/traits.dm
@@ -106,10 +106,12 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_CANNOT_PULL" = TRAIT_CANNOT_PULL,
"TRAIT_BSG_IMMUNE" = TRAIT_BSG_IMMUNE,
"TRAIT_FLYING" = TRAIT_FLYING,
+ "TRAIT_UNKNOWN" = TRAIT_UNKNOWN,
"TRAIT_ANTIMAGIC" = TRAIT_ANTIMAGIC,
"TRAIT_ANTIMAGIC_NO_SELFBLOCK" = TRAIT_ANTIMAGIC_NO_SELFBLOCK,
"TRAIT_RECENTLY_BLOCKED_MAGIC" = TRAIT_RECENTLY_BLOCKED_MAGIC,
- "TRAIT_UNKNOWN" = TRAIT_UNKNOWN
+ "TRAIT_UNKNOWN" = TRAIT_UNKNOWN,
+ "TRAIT_EXAMINE_HALLUCINATING" = TRAIT_EXAMINE_HALLUCINATING
),
/datum/mind = list(
diff --git a/code/modules/hallucinations/effects/minor.dm b/code/modules/hallucinations/effects/minor.dm
index 0d55a6c95f0..7a1d8d8211d 100644
--- a/code/modules/hallucinations/effects/minor.dm
+++ b/code/modules/hallucinations/effects/minor.dm
@@ -196,3 +196,21 @@
target?.health_hud_override = HEALTH_HUD_OVERRIDE_NONE
target?.update_health_hud()
return ..()
+
+/**
+ * # Hallucination - Examine Hallucination
+ *
+ * A generic hallucination that causes the target to see unique examine descriptions
+ */
+/obj/effect/hallucination/examine_hallucination
+ var/trait_applied = TRAIT_EXAMINE_HALLUCINATING
+ duration = list(40 SECONDS, 60 SECONDS)
+
+/obj/effect/hallucination/examine_hallucination/Initialize(mapload, mob/living/carbon/hallucination_target)
+ . = ..()
+ ADD_TRAIT(hallucination_target, trait_applied, UNIQUE_TRAIT_SOURCE(src))
+
+/obj/effect/hallucination/examine_hallucination/Destroy()
+ REMOVE_TRAIT(target, trait_applied, UNIQUE_TRAIT_SOURCE(src))
+ return ..()
+
diff --git a/code/modules/hallucinations/hallucinations.dm b/code/modules/hallucinations/hallucinations.dm
index 69a87084538..a860b89377b 100644
--- a/code/modules/hallucinations/hallucinations.dm
+++ b/code/modules/hallucinations/hallucinations.dm
@@ -6,6 +6,7 @@ GLOBAL_LIST_INIT(hallucinations, list(
/obj/effect/hallucination/speech = 15,
/obj/effect/hallucination/audio = 25,
/obj/effect/hallucination/audio/localized = 25,
+ /obj/effect/hallucination/examine_hallucination = 25,
),
HALLUCINATE_MODERATE = list(
/obj/effect/hallucination/delusion = 5,
diff --git a/code/modules/mob/living/carbon/examine.dm b/code/modules/mob/living/carbon/examine.dm
index 4f2d5abaa86..ccd25a6d2a2 100644
--- a/code/modules/mob/living/carbon/examine.dm
+++ b/code/modules/mob/living/carbon/examine.dm
@@ -90,6 +90,7 @@
/mob/living/carbon/examine(mob/user)
if(HAS_TRAIT(src, TRAIT_UNKNOWN))
return list("You're struggling to make out any details...")
+
var/skipgloves = FALSE
var/skipsuitstorage = FALSE
var/skipjumpsuit = FALSE
@@ -98,6 +99,7 @@
var/skipears = FALSE
var/skipeyes = FALSE
var/skipface = FALSE
+ var/hallucinating = HAS_TRAIT(user, TRAIT_EXAMINE_HALLUCINATING)
//exosuits and helmets obscure our view and stuff.
if(wear_suit)
@@ -165,6 +167,32 @@
// add any extra info on the limbs themselves
msg += examine_handle_individual_limb(limb_name)
+ // hallucinating?
+ if(hallucinating && prob(50))
+ // List of hallucination messages
+ var/list/hallucination_texts = list(
+ "You blink, and for a moment, [p_their()] body shimmers like a mirage, [p_their()] gaze unsettlingly intense.",
+ "[p_they(TRUE)] appear[p_s()] to be surrounded by a swarm of tiny, glowing butterflies.",
+ "[p_they(TRUE)] [p_are()] wearing a crown made of spaghetti. Wait, no... it's gone now.",
+ "[p_they(TRUE)] look[p_s()] suspicious, as if plotting a jelly heist.",
+ "[p_they(TRUE)] begin[p_s()] to hum a tune, but the sound seems to echo from all directions at once.",
+ "[p_they(TRUE)] smile [p_s()], and for a second, [p_their()] face twists into a thousand tiny reflections.",
+ "[p_they(TRUE)] seem[p_s()] to float slightly above the ground, [p_their()] feet just brushing against the floor.",
+ "[p_their(TRUE)] hands flicker like holograms, shifting between different gestures before returning to normal.",
+ "[p_they(TRUE)] seems to be cloaked in a faint, swirling fog that disappears the moment you focus on it.",
+ "You glance at [p_them()], and for an instant, [p_their()] shadow stretches unnaturally long, as if reaching for something just out of view. Did that shadow have a face?",
+ "You glance at [p_them()], and for a moment, [p_their()] eyes seem to flash with a strange, metallic gleam. You could have sworn it was gold... or was it red?",
+ "[p_they(TRUE)] seem[p_s()] to be walking straight towards you, [p_their()] silhouette stretching longer than it should. Were [p_their()] footsteps too quiet? Or is it just you? There's something off about the way [p_they()] move[p_s()].",
+ "For a moment, [p_they()] snap[p_s()] to an odd position, [p_their()] head and legs stiff and unwavering. [p_their(TRUE)] arms are outstretched to [p_their()] sides, and you see black where [p_their()] eyes should be.",
+ "[p_they(TRUE)] [p_have()] no face. There's an impossibly dark layer of nothingness where it should be. [p_their(TRUE)] sclerae are the only indication [p_they()] still [p_have()] eyes.",
+ "You swear you just saw [p_them()] sobbing and begging!",
+ "[p_they(TRUE)] [p_are()] bleeding profusely! [p_their(TRUE)] blood is crawling its way back in!",
+ "[p_their(TRUE)] head violently jerks to meet your gaze."
+ )
+ // Pick a random hallucination description
+ var/random_text = pick(hallucination_texts)
+ msg += "[random_text]\n"
+
//handcuffed?
if(handcuffed)
if(istype(handcuffed, /obj/item/restraints/handcuffs/cable/zipties))