Files
Aurora.3/code/modules/events/wandering_psirens.dm
VMSolidusandGitHub 90f676eb19 Please Come Save Me, I'm In A Lifepod Just Outside! (#22868)
<img width="592" height="283" alt="image"
src="https://github.com/user-attachments/assets/0a3f1e59-b0f7-47e8-9575-adc161fc12ba"
/>

Please come outside, I'd love to meet you. Leave your space suit, you
won't need it.

<img width="250" height="250" alt="image"
src="https://github.com/user-attachments/assets/f1866082-6360-4274-959a-a91336ac2df7"
/>
2026-07-25 13:53:55 +00:00

80 lines
2.7 KiB
Plaintext

/// Wandering Psirens, an event similar enough to Carp Migration that I can reuse much of the code.
/datum/event/wandering_psirens
announceWhen = 50
endWhen = 900
var/list/spawned_psirens = list()
var/list/despawn_turfs = list(
/turf/space,
/turf/simulated/floor/exoplanet/asteroid,
/turf/simulated/open,
/turf/simulated/floor/reinforced/airless // Station roof.
)
/datum/event/wandering_psirens/setup()
announceWhen = rand(40, 60)
endWhen = rand(600, 1200)
despawn_turfs = typecacheof(despawn_turfs)
/datum/event/wandering_psirens/announce()
// Pings every "Psi-sensitive", will trigger feedback on people's mindshields.
for (var/mob/victim in GLOB.player_list)
if (SShallucinations.is_adpi_excluded(victim) || SShallucinations.is_adpi_blocked(victim))
continue
SShallucinations.send_adpi_message(victim, null, FALSE)
/datum/event/wandering_psirens/start()
..()
if(severity == EVENT_LEVEL_MAJOR)
spawn_psirens(length(GLOB.landmarks_list))
else if(severity == EVENT_LEVEL_MODERATE)
spawn_psirens(rand(4, 6)) //12 to 30 psirens
else
spawn_psirens(rand(1, 3), 1, 2) //1 to 6 psirens, alone or in pairs
/datum/event/wandering_psirens/proc/spawn_psirens(num_groups, group_size_min = 3, group_size_max = 5)
set waitfor = FALSE
var/list/spawn_locations = list()
for(var/obj/effect/landmark/C in GLOB.landmarks_list)
if(C.name == "carpspawn") // Reusing the carp landmarks. :)
spawn_locations.Add(C.loc)
spawn_locations = shuffle(spawn_locations)
num_groups = min(num_groups, spawn_locations.len)
var/i = 1
while (i <= num_groups)
var/group_size = rand(group_size_min, group_size_max)
for(var/j = 1, j <= group_size, j++)
if(prob(75))
var/basic_psiren
if (prob(50))
basic_psiren = new /mob/living/simple_animal/hostile/psiren(spawn_locations[i])
else basic_psiren = new /mob/living/simple_animal/hostile/psiren/ranged(spawn_locations[i])
spawned_psirens += WEAKREF(basic_psiren)
else
if (prob(75))
var/mob/living/simple_animal/hostile/psiren/omen/new_omen = new(spawn_locations[i])
spawned_psirens += WEAKREF(new_omen)
else
var/mob/living/simple_animal/hostile/psiren/omen/beckoner/new_beckoner = new(spawn_locations[i])
spawned_psirens += WEAKREF(new_beckoner)
CHECK_TICK
i++
/datum/event/wandering_psirens/end(faked)
..()
for (var/datum/weakref/psiren_weakref in spawned_psirens)
var/mob/living/simple_animal/hostile/psiren/psiren = psiren_weakref.resolve()
if (psiren && prob(50) && is_type_in_typecache(psiren.loc, despawn_turfs))
spawned_psirens -= psiren_weakref
qdel(psiren_weakref)
spawned_psirens?.Cut()
/datum/event/wandering_psirens/overmap
despawn_turfs = list(/turf/space)