Dynamic Mice: Let's populate maintenance randomly (#28178)

* oh sh- A RAT

* Add suggestions, and tweak mice number to round up
This commit is contained in:
Vi3trice
2025-02-10 03:06:04 +00:00
committed by GitHub
parent 3ace66e481
commit aa6cb23636
6 changed files with 90 additions and 400 deletions
@@ -27,4 +27,34 @@ SUBSYSTEM_DEF(late_mapping)
var/duration = stop_watch(watch)
log_startup_progress("Generated [mgcount] mazes in [duration]s")
maintenance_mice()
GLOB.spawn_pool_manager.process_pools()
/**
* Randomly spawns mice in maintenance instead of being purely fixed spawn points
*/
/datum/controller/subsystem/late_mapping/proc/maintenance_mice()
var/watch = start_watch()
log_startup_progress("Populating maintenance with mice...")
// Looking up for maintenance floors specifically as possible spawn points
var/list/maintenance_turfs = list()
for(var/area/station/maintenance/A in SSmapping.existing_station_areas)
for(var/turf/simulated/floor/F in A)
if(locate(/obj/structure/window) in F)
continue
maintenance_turfs.Add(F)
if(!length(maintenance_turfs))
log_debug("No valid turfs has been found for mice.")
return
// The ratio is based on turfs per mice. Using Boxstation as an example, it would average between 20 to 30 mice.
var/floor_tiles_per_one_mice = rand(125, 200)
var/mice_number = ceil(length(maintenance_turfs) / floor_tiles_per_one_mice)
for(var/i in 1 to mice_number)
new /mob/living/simple_animal/mouse(pick_n_take(maintenance_turfs))
log_debug("Spawned [mice_number] mice over in [stop_watch(watch)]s")