[MIRROR] Fixes Massive Radio Overtime, Implements a Spatial Grid System for Faster Searching Over Areas [MDB IGNORE] (#10107)

* Fixes Massive Radio Overtime, Implements a Spatial Grid System for Faster Searching Over Areas

* no spamming pings for upstream :(

* E

* E

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
SkyratBot
2021-12-23 03:06:56 +00:00
committed by GitHub
co-authored by Kylerace GoldenAlpharex Gandalf
parent 1c422bbda2
commit 119356e97f
74 changed files with 2015 additions and 931 deletions
+11 -4
View File
@@ -148,12 +148,16 @@
var/list/bounds
src.bounds = bounds = list(1.#INF, 1.#INF, 1.#INF, -1.#INF, -1.#INF, -1.#INF)
for(var/I in gridSets)
var/datum/grid_set/gset = I
//used for sending the maxx and maxy expanded global signals at the end of this proc
var/has_expanded_world_maxx = FALSE
var/has_expanded_world_maxy = FALSE
for(var/datum/grid_set/gset as anything in gridSets)
var/ycrd = gset.ycrd + y_offset - 1
var/zcrd = gset.zcrd + z_offset - 1
if(!cropMap && ycrd > world.maxy)
world.maxy = ycrd // Expand Y here. X is expanded in the loop below
has_expanded_world_maxy = TRUE
var/zexpansion = zcrd > world.maxz
if(zexpansion)
if(cropMap)
@@ -179,6 +183,7 @@
break
else
world.maxx = xcrd
has_expanded_world_maxx = TRUE
if(xcrd >= 1)
var/model_key = copytext(line, tpos, tpos + key_len)
@@ -207,11 +212,13 @@
CHECK_TICK
if(!no_changeturf)
for(var/t in block(locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]), locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])))
var/turf/T = t
for(var/turf/T as anything in block(locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]), locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])))
//we do this after we load everything in. if we don't; we'll have weird atmos bugs regarding atmos adjacent turfs
T.AfterChange(CHANGETURF_IGNORE_AIR)
if(has_expanded_world_maxx || has_expanded_world_maxy)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_EXPANDED_WORLD_BOUNDS, has_expanded_world_maxx, has_expanded_world_maxy)
#ifdef TESTING
if(turfsSkipped)
testing("Skipped loading [turfsSkipped] default turfs")