mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 12:07:27 +01:00
Refactor spawning on vents into one proc
This commit is contained in:
@@ -2,25 +2,18 @@
|
||||
/datum/event/spider_terror
|
||||
announceWhen = 240
|
||||
var/spawncount = 1
|
||||
var/successSpawn = FALSE //So we don't make a command report if nothing gets spawned.
|
||||
|
||||
/datum/event/spider_terror/setup()
|
||||
announceWhen = rand(announceWhen, announceWhen + 30)
|
||||
spawncount = 1
|
||||
|
||||
/datum/event/spider_terror/announce()
|
||||
GLOB.command_announcement.Announce("Confirmed outbreak of level 3 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/effects/siren-spooky.ogg')
|
||||
if(successSpawn)
|
||||
GLOB.command_announcement.Announce("Confirmed outbreak of level 3 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", 'sound/effects/siren-spooky.ogg')
|
||||
|
||||
/datum/event/spider_terror/start()
|
||||
|
||||
var/list/vents = list()
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/temp_vent in GLOB.all_vent_pumps)
|
||||
if(is_station_level(temp_vent.loc.z) && !temp_vent.welded)
|
||||
if(!temp_vent.parent)
|
||||
// Issue happening more often with vents. Log and continue. Delete once solved
|
||||
log_debug("spider_terror/start(), vent has no parent: [temp_vent], qdeled: [QDELETED(temp_vent)], loc: [temp_vent.loc]")
|
||||
continue
|
||||
if(temp_vent.parent.other_atmosmch.len > 50)
|
||||
vents += temp_vent
|
||||
var/list/vents = get_valid_vent_spawns()
|
||||
var/spider_type
|
||||
var/infestation_type = pick(1, 2, 3, 4, 5)
|
||||
switch(infestation_type)
|
||||
@@ -39,15 +32,9 @@
|
||||
if(5)
|
||||
spider_type = /mob/living/simple_animal/hostile/poison/terror_spider/princess
|
||||
spawncount = 2
|
||||
while(spawncount >= 1 && vents.len)
|
||||
var/obj/machinery/atmospherics/unary/vent_pump/vent = pick(vents)
|
||||
|
||||
if(vent.welded)
|
||||
vents -= vent
|
||||
continue
|
||||
|
||||
while(spawncount && length(vents))
|
||||
var/obj/vent = pick(vents)
|
||||
// If the vent we picked has any living mob nearby, just remove it from the list, loop again, and pick something else.
|
||||
|
||||
var/turf/T = get_turf(vent)
|
||||
var/hostiles_present = FALSE
|
||||
for(var/mob/living/L in viewers(T))
|
||||
@@ -59,4 +46,5 @@
|
||||
if(!hostiles_present)
|
||||
new spider_type(vent.loc)
|
||||
spawncount--
|
||||
successSpawn = TRUE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user