Maybe make deepspace levels slightly more robust?

This commit is contained in:
Chompstation Bot
2021-05-25 21:32:11 +00:00
parent f659385148
commit 5af77e4b11
3 changed files with 50 additions and 26 deletions

View File

@@ -49,6 +49,12 @@
LAZYADD(SSshuttles.sectors_to_initialize, src) //Queued for further init. Will populate the waypoint lists; waypoints not spawned yet will be added in as they spawn.
SSshuttles.process_init_queues()
// You generally shouldn't destroy these.
/obj/effect/overmap/visitable/Destroy()
testing("Deleting [src] overmap sector at [x],[y]")
unregister_z_levels()
return ..()
//This is called later in the init order by SSshuttles to populate sector objects. Importantly for subtypes, shuttles will be created by then.
/obj/effect/overmap/visitable/proc/populate_sector_objects()
@@ -78,6 +84,19 @@
global.using_map.map_levels |= map_z
*/
/obj/effect/overmap/visitable/proc/unregister_z_levels()
map_sectors -= map_z
global.using_map.player_levels -= map_z
if(!in_space)
global.using_map.sealed_levels -= map_z
/* VOREStation Removal - We have a map system that does this already.
if(base)
global.using_map.station_levels -= map_z
global.using_map.contact_levels -= map_z
global.using_map.map_levels -= map_z
*/
/obj/effect/overmap/visitable/proc/get_space_zlevels()
if(in_space)
return map_z
@@ -117,6 +136,9 @@
/obj/effect/overmap/visitable/proc/generate_skybox()
return
/obj/effect/overmap/visitable/proc/cleanup()
return FALSE
/obj/effect/overmap/visitable/MouseEntered(location, control, params)
openToolTip(user = usr, tip_src = src, params = params, title = name)

View File

@@ -1,24 +1,24 @@
//list used to cache empty zlevels to avoid nedless map bloat
var/list/cached_space = list()
//Space stragglers go here
/obj/effect/overmap/visitable/sector/temporary
name = "Deep Space"
invisibility = 101
known = 0
in_space = TRUE
/obj/effect/overmap/visitable/sector/temporary/New(var/nx, var/ny, var/nz)
/obj/effect/overmap/visitable/sector/temporary/New(var/nx, var/ny)
loc = locate(nx, ny, global.using_map.overmap_z)
x = nx
y = ny
map_z += nz
map_sectors["[nz]"] = src
testing("Temporary sector at [x],[y] was created, corresponding zlevel is [nz].")
var/emptyz = global.using_map.get_empty_zlevel()
map_z += emptyz
map_sectors["[emptyz]"] = src
testing("Temporary sector at [x],[y] was created, corresponding zlevel is [emptyz].")
/obj/effect/overmap/visitable/sector/temporary/Destroy()
map_sectors["[map_z]"] = null
testing("Temporary sector at [x],[y] was deleted.")
for(var/zlevel in map_z)
using_map.cache_empty_zlevel(zlevel)
testing("Temporary sector at [x],[y] was destroyed, returning empty zlevel [map_z[1]] to map datum.")
return ..()
/obj/effect/overmap/visitable/sector/temporary/proc/can_die(var/mob/observer)
testing("Checking if sector at [map_z[1]] can die.")
@@ -28,6 +28,10 @@ var/list/cached_space = list()
return 0
return 1
/obj/effect/overmap/visitable/sector/temporary/cleanup()
if(can_die())
qdel(src)
proc/get_deepspace(x,y)
var/turf/unsimulated/map/overmap_turf = locate(x,y,global.using_map.overmap_z)
if(!istype(overmap_turf))
@@ -35,13 +39,7 @@ proc/get_deepspace(x,y)
var/obj/effect/overmap/visitable/sector/temporary/res = locate() in overmap_turf
if(istype(res))
return res
else if(cached_space.len)
res = cached_space[cached_space.len]
cached_space -= res
res.forceMove(overmap_turf)
return res
else
return new /obj/effect/overmap/visitable/sector/temporary(x, y, global.using_map.get_empty_zlevel())
return new /obj/effect/overmap/visitable/sector/temporary(x, y)
/atom/movable/proc/lost_in_space()
for(var/atom/movable/AM in contents)
@@ -139,9 +137,4 @@ proc/overmap_spacetravel(var/turf/space/T, var/atom/movable/A)
if(D.pulling)
D.pulling.forceMove(dest)
if(istype(M, /obj/effect/overmap/visitable/sector/temporary))
var/obj/effect/overmap/visitable/sector/temporary/source = M
if (source.can_die())
testing("Caching [M] for future use")
source.moveToNullspace()
cached_space += source
M.cleanup()