Files
Bubberstation/code/modules/hallucination/bolted_airlocks.dm
MrMelbert eb0e842320 Hallucination revamps and additions (#89865)
## About The Pull Request

1. Hallucination effects are now tiered

Hallucinations now all have tiers, ranging from common to special. 
If you are just hallucinating a teeny bit, you will not experience the
more extreme hallucinations, like bubblegum or your mom.
But if you're hallucinating off your butt, you will be a bit more likely
to experience them.

2. Hallucination rate has been tweaked

Default hallucination cooldown is now 20-80 seconds, up from 10-60
seconds.
However the cooldown will *also* vary depending on just how much you're
hallucinating, going down to 10-40 seconds.

3. RDS is now capped a bit lower (meaning you don't see the higher tiers
like bubblegum).

But I added a preference to uncap it. For the people who actually like
bubblegum visits.

4. If a hallucination fails to trigger, the cooldown will partially
reset. (by 75%)

5. "Fake chat" hallucination will pick more viable subjects.

Fake chat will try to find someone who can actually speak your language,
rather than make a monkey speak mothic or something.
(I may revisit this so if you're super-hallucinating it reverts to old
behavior though.)

6. Adds a hallucination: Fake blood

You hallucinate that you start bleeding, very simple.

7. Adds a hallucination: Fake telepathy

You hallucinate a random telepathic message, similar to fake chat.

8. Adds a hallucination: Eyes in the Dark

A nearby dark turf will have a set of glowing red eyes shine through the
dark. A classic.

9. Adds some new sub-hallucination: PDA ringtone (fake sound), summon
guns/magic (fake item)

Funny prank.

10. Makes mindbreaker a bit more effective at combating RDS.

Pretty much does nothing right now unless you gulp like 50u.

## Why It's Good For The Game

Hallucinations are pretty one note if you experience them for longer
than 10 minutes.

This is due to two fold:
- Many hallucinations are goofy, and not subtle
- Hallucinations trigger very rapidly

You will never fall for a hallucination because in between "You see John
Greytide put the blueprints away", you get your mom yelling at you,
everyone looking like syndies (again), and bubblegum

This pr addresses it by
- Limiting the wacky hallucinations for when you're really off your
gourd
- Reducing the period between triggers
- Adding a few hallucinations

If the wackier hallucinations are reserved for when you're really off
your rocker, this lets the more subtle ones sink in over time, leaves
more room for second guessing

## Changelog

🆑 Melbert
add: Adds 4-5 new hallucinations. Collect them all.
balance: If you are only hallucinating a little bit, the game will
prefer to pick more subtle hallucinations. If you are hallucinating a
ton, it will prefer the more wacky hallucinations.
balance: If you are only hallucinating a little bit, the cooldown
between hallucinations is longer. If you are hallucinating a ton, it
will be shorter.
balance: If a hallucination fails to trigger (such as a deaf person
getting a sound hallucination) the next one will be a lot sooner.
balance: RDS hallucination amount is capped at mid tier hallucinations.
This means bubblegum and co. will be a lot rarer, or will even never
show. HOWEVER, there is now a preference allowing you to uncap your RDS
hallucinations.
balance: Mindbreaker toxin is more effective at suppressing RDS.
balance: Some hallucinations effects have been tweaked up or down
according to the new thresholds. Madness mask as an example.
fix: "Fake Fire" Hallucination works again, and now has a unique message
for if you stop-drop-roll that other people see.
/🆑
2025-03-20 21:36:56 +00:00

130 lines
4.2 KiB
Plaintext

/datum/hallucination/bolts
random_hallucination_weight = 7
hallucination_tier = HALLUCINATION_TIER_COMMON
/// A list of weakrefs to airlocks we bolt down around us
var/list/datum/weakref/airlocks_to_hit
/// A list of weakrefs to fake lock hallucinations we've created
var/list/datum/weakref/locks
/// A number relating to the number of ssfastprocessing ticks (x 10) until the next action
var/next_action = 0
/// Whether we're currently locking, or unlocking
var/locking = TRUE
/datum/hallucination/bolts/start()
var/door_number = rand(0, 4) //if 0, we bolt all visible doors
feedback_details += "Door amount: [door_number]"
for(var/obj/machinery/door/airlock/nearby_airlock in view(hallucinator))
if(LAZYLEN(airlocks_to_hit) > door_number && door_number > 0)
break
if(!nearby_airlock.density)
continue
LAZYADD(airlocks_to_hit, WEAKREF(nearby_airlock))
if(!LAZYLEN(airlocks_to_hit)) // Not an airlock in sight
return FALSE
START_PROCESSING(SSfastprocess, src)
return TRUE
/datum/hallucination/bolts/process(seconds_per_tick)
if(QDELETED(src))
return
next_action -= (seconds_per_tick * 10)
if(next_action > 0)
return
if(locking)
var/datum/weakref/next_airlock = pop(airlocks_to_hit)
var/obj/machinery/door/airlock/to_lock = next_airlock?.resolve()
if(to_lock)
var/obj/effect/client_image_holder/hallucination/fake_door_lock/lock = new(to_lock.loc, hallucinator, src, to_lock)
LAZYADD(locks, WEAKREF(lock))
if(!LAZYLEN(airlocks_to_hit))
locking = FALSE
next_action = 100
return
else
var/datum/weakref/next_unlock = popleft(locks)
var/obj/effect/client_image_holder/hallucination/fake_door_lock/to_unlock = next_unlock?.resolve()
if(to_unlock)
to_unlock.unlock()
else
// All unlocked, qdel time
qdel(src)
return
next_action = rand(4, 12)
/datum/hallucination/bolts/Destroy()
// Clean up any locks we happen to have remaining on qdel.
// Hypothetically this shouldn't delete anything. But just in case.
for(var/datum/weakref/leftover_lock_ref as anything in locks)
var/obj/effect/client_image_holder/hallucination/fake_door_lock/leftover_lock = leftover_lock_ref.resolve()
if(!QDELETED(leftover_lock))
qdel(leftover_lock)
STOP_PROCESSING(SSfastprocess, src)
return ..()
/obj/effect/client_image_holder/hallucination/fake_door_lock
layer = CLOSED_DOOR_LAYER + 1 //for Bump priority
plane = GAME_PLANE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
/// The real airlock we're fake bolting down.
var/obj/machinery/door/airlock/airlock
/obj/effect/client_image_holder/hallucination/fake_door_lock/Initialize(mapload, list/mobs_which_see_us, datum/hallucination/parent, obj/machinery/door/airlock/airlock)
if(!airlock)
stack_trace("[type] was created somewhere without an associated airlock.")
return INITIALIZE_HINT_QDEL
src.airlock = airlock
RegisterSignal(airlock, COMSIG_QDELETING, PROC_REF(on_airlock_deleted))
// We need to grab these for our image before we run our parent's parent initialize
src.image_icon = airlock.overlays_file
src.image_state = "lights_[AIRLOCK_LIGHT_BOLTS]"
return ..()
/obj/effect/client_image_holder/hallucination/fake_door_lock/Destroy(force)
UnregisterSignal(airlock, COMSIG_QDELETING)
airlock = null
return ..()
/obj/effect/client_image_holder/hallucination/fake_door_lock/generate_image()
var/image/created = ..()
created.layer = airlock.layer + 0.1
return created
/obj/effect/client_image_holder/hallucination/fake_door_lock/show_image_to(mob/show_to)
. = ..()
show_to.playsound_local(get_turf(src), 'sound/machines/airlock/boltsdown.ogg', 30, FALSE, 3)
/obj/effect/client_image_holder/hallucination/fake_door_lock/hide_image_from(mob/show_to)
. = ..()
show_to.playsound_local(get_turf(src), 'sound/machines/airlock/boltsup.ogg', 30, FALSE, 3)
/obj/effect/client_image_holder/hallucination/fake_door_lock/proc/on_airlock_deleted(datum/source)
SIGNAL_HANDLER
qdel(src)
/obj/effect/client_image_holder/hallucination/fake_door_lock/proc/unlock()
for(var/mob/seer as anything in who_sees_us)
hide_image_from(seer)
shown_image = null
qdel(src)
/obj/effect/client_image_holder/hallucination/fake_door_lock/CanAllowThrough(atom/movable/mover, border_dir)
if((mover in who_sees_us) && airlock.density)
return FALSE
return ..()