From 00bc4202f7939aaaf4137cb5cf164e39a727652c Mon Sep 17 00:00:00 2001 From: Hatterhat Date: Sat, 29 Aug 2020 23:08:51 -0500 Subject: [PATCH] what the fuck was i thinking coding this --- code/controllers/subsystem/minimum_spawns.dm | 50 ++++++++++++-------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/code/controllers/subsystem/minimum_spawns.dm b/code/controllers/subsystem/minimum_spawns.dm index a14501375d..3276c25c86 100644 --- a/code/controllers/subsystem/minimum_spawns.dm +++ b/code/controllers/subsystem/minimum_spawns.dm @@ -36,12 +36,12 @@ GLOBAL_LIST_INIT(minimum_snow_under_spawns, list( // step 5: snaxi support - done? /datum/controller/subsystem/min_spawns/Initialize(start_timeofday) - if(SSmapping.levels_by_trait(ZTRAIT_LAVA_RUINS)) //todo: recognizing maps that aren't lavaland mining but are also not snaxi - active_spawns = GLOB.minimum_lavaland_spawns - else if(SSmapping.levels_by_trait(ZTRAIT_ICE_RUINS)) + if(SSmapping.levels_by_trait(ZTRAIT_ICE_RUINS)) active_spawns = GLOB.minimum_snow_surface_spawns active_spawns_2 = GLOB.minimum_snow_under_spawns snaxi_snowflake_check = TRUE + else if(SSmapping.levels_by_trait(ZTRAIT_LAVA_RUINS)) //todo: recognizing maps that aren't lavaland mining but are also not snaxi + active_spawns = GLOB.minimum_lavaland_spawns if(!active_spawns && !active_spawns_2) return ..() // call it a day i guess // borrowing this from auxbase code - see code\modules\mining\aux_base.dm @@ -102,20 +102,20 @@ GLOBAL_LIST_INIT(minimum_snow_under_spawns, list( if((istype(MS_tospawn, /mob/living/simple_animal/hostile/megafauna)) && get_dist(RT, H) <= 70) // INIT_ANNOUNCE("MSTS failed - [MS_tospawn] too close to [H], [get_dist(RT, H)] tiles distance, [RT.x] [RT.y] [RT.z]") active_spawns.Add(MS_tospawn) - return //let's try not to dump megas too close to each other? + continue //let's try not to dump megas too close to each other? if((istype(MS_tospawn, /obj/structure/spawner)) && get_dist(RT, H) <= 40) // INIT_ANNOUNCE("MSTS failed - [MS_tospawn] too close to [H], [get_dist(RT, H)] tiles distance, [RT.x] [RT.y] [RT.z]") active_spawns.Add(MS_tospawn) - return //let's at least /try/ to space these out? + continue //let's at least /try/ to space these out? for(var/obj/structure/spawner/LT in urange(70,RT)) //prevents tendril/mega clumps if((istype(MS_tospawn, /mob/living/simple_animal/hostile/megafauna)) && get_dist(RT, LT) <= 70) - active_spawns.Add(MS_tospawn) // INIT_ANNOUNCE("MSTS failed - [MS_tospawn] too close to [LT], [get_dist(RT, LT)] tiles distance, [RT.x] [RT.y] [RT.z]") - return //let's try not to dump megas too close to each other? + active_spawns.Add(MS_tospawn) + continue //let's try not to dump megas too close to each other? if((istype(MS_tospawn, /obj/structure/spawner)) && get_dist(RT, LT) <= 40) - active_spawns.Add(MS_tospawn) // INIT_ANNOUNCE("MSTS failed - [MS_tospawn] too close to [LT], [get_dist(RT, LT)] tiles distance, [RT.x] [RT.y] [RT.z]") - return //let's at least /try/ to space these out? + active_spawns.Add(MS_tospawn) + continue //let's at least /try/ to space these out? // man the overhead on this is gonna SUCK // INIT_ANNOUNCE("MSTS succeeded! - [MS_tospawn] spawning at [RT.x] [RT.y] [RT.z]") new MS_tospawn(RT) @@ -125,21 +125,29 @@ GLOBAL_LIST_INIT(minimum_snow_under_spawns, list( if(where_we_droppin_boys_iterations >= 1250) INIT_ANNOUNCE("Minimum Spawns subsystem stopped early on active list 2 - too many iterations!") break - var/turf/RT = pick_n_take(valid_mining_turfs_2) //Pick a random mining Z-level turf + var/turf/RT2 = pick_n_take(valid_mining_turfs_2) //Pick a random mining Z-level turf var/MS2_tospawn = pick_n_take(active_spawns_2) - for(var/mob/living/simple_animal/hostile/H in urange(70,RT)) //prevents mob clumps - if((istype(MS2_tospawn, /mob/living/simple_animal/hostile/megafauna) || ismegafauna(H)) && get_dist(RT, H) <= 70) + for(var/mob/living/simple_animal/hostile/H in urange(70,RT2)) //prevents mob clumps + if((istype(MS2_tospawn, /mob/living/simple_animal/hostile/megafauna) || ismegafauna(H)) && get_dist(RT2, H) <= 70) + // INIT_ANNOUNCE("MS2TS failed - [MS2_tospawn] too close to [H], [get_dist(RT2, H)] tiles distance, [RT2.x] [RT2.y] [RT2.z]") active_spawns_2.Add(MS2_tospawn) - return //let's try not to dump megas too close to each other? - if((istype(MS2_tospawn, /obj/structure/spawner)) && get_dist(RT, H) <= 40) + continue //let's try not to dump megas too close to each other? + if((istype(MS2_tospawn, /obj/structure/spawner)) && get_dist(RT2, H) <= 40) + // INIT_ANNOUNCE("MS2TS failed - [MS2_tospawn] too close to [H], [get_dist(RT2, H)] tiles distance, [RT2.x] [RT2.y] [RT2.z]") active_spawns_2.Add(MS2_tospawn) - return //let's at least /try/ to space these out? - for(var/obj/structure/spawner/LT in urange(70,RT)) //prevents tendril/mega clumps - if((istype(MS2_tospawn, /mob/living/simple_animal/hostile/megafauna)) && get_dist(RT, LT) <= 70) + continue //let's at least /try/ to space these out? + for(var/obj/structure/spawner/LT in urange(70,RT2)) //prevents tendril/mega clumps + if((istype(MS2_tospawn, /mob/living/simple_animal/hostile/megafauna)) && get_dist(RT2, LT) <= 70) + // INIT_ANNOUNCE("MS2TS failed - [MS2_tospawn] too close to [LT], [get_dist(RT2, LT)] tiles distance, [RT2.x] [RT2.y] [RT2.z]") active_spawns_2.Add(MS2_tospawn) - return //let's try not to dump megas too close to each other? - if((istype(MS2_tospawn, /obj/structure/spawner)) && get_dist(RT, LT) <= 40) + continue //let's try not to dump megas too close to each other? + if((istype(MS2_tospawn, /obj/structure/spawner)) && get_dist(RT2, LT) <= 40) + // INIT_ANNOUNCE("MS2TS failed - [MS2_tospawn] too close to [LT], [get_dist(RT2, LT)] tiles distance, [RT2.x] [RT2.y] [RT2.z]") active_spawns_2.Add(MS2_tospawn) - return //let's at least /try/ to space these out? + continue //let's at least /try/ to space these out? // man the overhead on this is gonna SUCK - new MS2_tospawn(RT) + // INIT_ANNOUNCE("MS2TS succeeded! - [MS2_tospawn] spawning at [RT2.x] [RT2.y] [RT2.z]") + new MS2_tospawn(RT2) + if(!active_spawns.len && !active_spawns_2.len) + // INIT_ANNOUNCE("Wrapping up! AS [active_spawns] AS2 [active_spawns_2]") + return // we're done here