diff --git a/code/WorkInProgress/Chinsky/overmap/_defines.dm b/code/WorkInProgress/Chinsky/overmap/_defines.dm index 55326b8da1..c81cbb1ae6 100644 --- a/code/WorkInProgress/Chinsky/overmap/_defines.dm +++ b/code/WorkInProgress/Chinsky/overmap/_defines.dm @@ -35,6 +35,9 @@ proc/toggle_move_stars(zlevel, direction) AM.throw_at(get_step(T,reverse_direction(direction)), 5, 1) +//list used to cache empty zlevels to avoid nedless map bloat +var/list/cached_space = list() + proc/overmap_spacetravel(var/turf/space/T, var/atom/movable/A) var/obj/effect/map/M = map_sectors["[T.z]"] if (!M) @@ -73,11 +76,26 @@ proc/overmap_spacetravel(var/turf/space/T, var/atom/movable/A) nz = TM.map_z testing("Destination: [TM]") else - world.maxz++ - nz = world.maxz - TM = new /obj/effect/map/sector/temporary(mapx, mapy, nz) - testing("Destination: *new* [TM]") + if(cached_space.len) + var/obj/effect/map/sector/temporary/cache = cached_space[cached_space.len] + cached_space -= cache + nz = cache.map_z + cache.x = mapx + cache.y = mapy + testing("Destination: *cached* [TM]") + else + world.maxz++ + nz = world.maxz + TM = new /obj/effect/map/sector/temporary(mapx, mapy, nz) + testing("Destination: *new* [TM]") var/turf/dest = locate(nx,ny,nz) if(dest) - A.loc = dest \ No newline at end of file + A.loc = dest + + if(istype(M, /obj/effect/map/sector/temporary)) + var/obj/effect/map/sector/temporary/source = M + if (source.can_die()) + testing("Catching [M] for future use") + source.loc = null + cached_space += source \ No newline at end of file diff --git a/code/WorkInProgress/Chinsky/overmap/sectors.dm b/code/WorkInProgress/Chinsky/overmap/sectors.dm index 410b418427..7f0b8548c9 100644 --- a/code/WorkInProgress/Chinsky/overmap/sectors.dm +++ b/code/WorkInProgress/Chinsky/overmap/sectors.dm @@ -117,9 +117,6 @@ var/global/list/map_sectors = list() /obj/effect/map/sector/temporary/proc/can_die(var/mob/observer) testing("Checking if sector at [map_z] can die.") - if(src.map_z < world.maxz) //can't specify which zlevel to remove - testing("It is not last sector in the stack.") - return 0 for(var/mob/M in player_list) if(M != observer && M.z == map_z) testing("There are people on it.")