Moves existing_station_areas to SSmapping, to prevent midround lag

This commit is contained in:
Qwertytoforty
2021-09-16 14:04:07 -04:00
parent b5df23090f
commit 23b74b126d
2 changed files with 10 additions and 8 deletions
+9
View File
@@ -10,6 +10,8 @@ SUBSYSTEM_DEF(mapping)
var/list/teleportlocs
/// List of all areas that can be accessed via IC and OOC means
var/list/ghostteleportlocs
///List of areas that exist on the station this shift
var/list/existing_station_areas
// This has to be here because world/New() uses [station_name()], which looks this datum up
/datum/controller/subsystem/mapping/PreInit()
@@ -89,6 +91,13 @@ SUBSYSTEM_DEF(mapping)
ghostteleportlocs = sortAssoc(ghostteleportlocs)
// Now we make a list of areas that exist on the station. Good for if you don't want to select areas that exist for one station but not others. Directly references
existing_station_areas = list()
for(var/area/AR in world)
var/turf/picked = safepick(get_area_turfs(AR.type))
if(picked && is_station_level(picked.z))
existing_station_areas += AR
// World name
if(GLOB.configuration.general.server_name)
world.name = "[GLOB.configuration.general.server_name]: [station_name()]"
+1 -8
View File
@@ -5,13 +5,6 @@
/datum/event/anomaly/proc/findEventArea()
var/static/list/allowed_areas
var/static/list/existing_areas
if(!existing_areas)
existing_areas = list()
for(var/area/AR in world)
var/turf/picked = safepick(get_area_turfs(AR.type))
if(picked && is_station_level(picked.z))
existing_areas += AR
if(!allowed_areas)
//Places that shouldn't explode
var/list/safe_area_types = typecacheof(list(
@@ -36,7 +29,7 @@
))
allowed_areas = typecacheof(GLOB.the_station_areas) - safe_area_types + unsafe_area_subtypes
var/list/possible_areas = typecache_filter_list(existing_areas, allowed_areas)
var/list/possible_areas = typecache_filter_list(SSmapping.existing_station_areas, allowed_areas)
if(length(possible_areas))
return pick(possible_areas)