Optimizes some functions (#24049)

* Optimizes some functions

* Update code/__HELPERS/unsorted.dm

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>

* Cached per AI now

* no more 80k character jumpscares

* parent functions exist

* I need a new keyboard

* Update code/modules/surgery/organs/vocal_cords.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/modules/mob/living/silicon/ai/ai_say.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/__HELPERS/game.dm

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>

* Update code/__HELPERS/game.dm

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>

---------

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
This commit is contained in:
GDN
2024-04-03 17:51:39 +00:00
committed by GitHub
co-authored by AffectedArc07 Burzah Contrabang S34N
parent 176e12ff04
commit cc0eee4b4d
16 changed files with 77 additions and 77 deletions
@@ -83,33 +83,47 @@ SUBSYSTEM_DEF(mapping)
log_startup_progress("Skipping lavaland ruins...")
// Now we make a list of areas for teleport locs
// Located below is some of the worst code I've ever seen
// Checking all areas to see if they have a turf in them? Nice one ssmapping!
var/list/all_areas = list()
for(var/area/areas in world)
all_areas += areas
teleportlocs = list()
for(var/area/AR in world)
for(var/area/AR as anything in all_areas)
if(AR.no_teleportlocs)
continue
if(teleportlocs[AR.name])
continue
var/turf/picked = safepick(get_area_turfs(AR.type))
var/list/pickable_turfs = list()
for(var/turf/turfs in AR)
pickable_turfs += turfs
var/turf/picked = safepick(pickable_turfs)
if(picked && is_station_level(picked.z))
teleportlocs[AR.name] = AR
teleportlocs = sortAssoc(teleportlocs)
ghostteleportlocs = list()
for(var/area/AR in world)
for(var/area/AR as anything in all_areas)
if(ghostteleportlocs[AR.name])
continue
var/list/turfs = get_area_turfs(AR.type)
if(turfs.len)
var/list/pickable_turfs = list()
for(var/turf/turfs in AR)
pickable_turfs += turfs
if(length(pickable_turfs))
ghostteleportlocs[AR.name] = AR
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))
for(var/area/AR as anything in all_areas)
var/list/pickable_turfs = list()
for(var/turf/turfs in AR)
pickable_turfs += turfs
var/turf/picked = safepick(pickable_turfs)
if(picked && is_station_level(picked.z))
existing_station_areas += AR