mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-25 14:00:18 +01:00
* Please describe the intent of your changes in a clear fashion. This PR addresses issue SERVER-PROD-12K by correcting a hard delete warning related to `/mob/living/simple_animal/hostile/carp` during the carp migration event. Previously, in `code/modules/events/carp_migration.dm`, the `end()` proc was calling `qdel(carp_weakref)` instead of `qdel(fish)`. This meant the weakref datum was being deleted, but the actual carp mob was left without a proper `qdel()` call, leading to BYOND's garbage collector performing a 'hard delete' and logging a warning. The fix changes `qdel(carp_weakref)` to `qdel(fish)` on line 103, ensuring the carp mob is correctly soft-deleted when the event ends. * Please make sure that, in the case of mapping changes, you include images of these changes in the PR's description. (No mapping changes in this PR) * Please make sure to mark your PR as wip or review required by making a comment with !wip or !review required * If you include sprites/sounds/... (assets) that you have not created yourself specify the license and original author below. * Ensure that you also credit them in the appropriate location / changelog as specified in the contributor guidelines ### Asset Licenses The following assets that **have not** been created by myself are included in this PR: | Path | Original Author | License | | --- | --- | --- | | icons/example.dmi | ExamplePerson (Example Station) | CC0 | (No new assets included in this PR) Fixes [SERVER-PROD-12K](https://aurorastation.sentry.io/issues/7522667244/?seerDrawer=true) --------- Co-authored-by: VMSolidus <evilexecutive@gmail.com>
80 lines
2.6 KiB
Plaintext
80 lines
2.6 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)
|
|
spawned_psirens?.Cut()
|
|
|
|
/datum/event/wandering_psirens/overmap
|
|
despawn_turfs = list(/turf/space)
|