Fixes temp sector initialization

This commit is contained in:
Atermonera
2021-10-31 12:09:13 -08:00
committed by VirgoBot
parent 0d688f44b5
commit c2a367e278
2 changed files with 36 additions and 2 deletions
+27 -1
View File
@@ -14,7 +14,19 @@
// But pick an empty z level to use
map_z += global.using_map.get_empty_zlevel()
. = ..()
<<<<<<< HEAD
testing("Temporary sector at [x],[y],[z] was created, corresponding zlevel is [english_list(map_z)].")
=======
loc = locate(nx, ny, global.using_map.overmap_z)
x = nx
y = ny
if(!map_z[1])
log_and_message_admins("Could not create empty sector at [nx], [ny]. No available z levels to allocate.")
return INITIALIZE_HINT_QDEL
map_sectors["[map_z[1]]"] = src
testing("Temporary sector at [x],[y] was created, corresponding zlevel is [map_z[1]].")
>>>>>>> 51f5290fa1a... Fixes temp sector initialization (#8325)
/obj/effect/overmap/visitable/sector/temporary/Destroy()
for(var/zlevel in map_z)
@@ -22,6 +34,9 @@
testing("Temporary sector at [x],[y] was destroyed, returning empty zlevel [map_z[1]] to map datum.")
return ..()
/obj/effect/overmap/visitable/sector/temporary/find_z_levels()
LAZYADD(map_z, global.using_map.get_empty_zlevel())
/obj/effect/overmap/visitable/sector/temporary/proc/is_empty(var/mob/observer)
if(!LAZYLEN(map_z))
log_and_message_admins("CANARY: [src] tried to check is_empty, but map_z is `[map_z || "null"]`")
@@ -44,7 +59,14 @@
var/obj/effect/overmap/visitable/sector/temporary/res = locate() in overmap_turf
if(istype(res))
return res
<<<<<<< HEAD
return new /obj/effect/overmap/visitable/sector/temporary(overmap_turf)
=======
res = new /obj/effect/overmap/visitable/sector/temporary(x, y)
if(QDELETED(res))
res = null
return res
>>>>>>> 51f5290fa1a... Fixes temp sector initialization (#8325)
/atom/movable/proc/lost_in_space()
for(var/atom/movable/AM in contents)
@@ -130,8 +152,10 @@
if(O != M && O.in_space && prob(50))
TM = O
break
if(!TM)
if(!istype(TM))
TM = get_deepspace(M.x,M.y)
if(!istype(TM))
return
nz = pick(TM.get_space_zlevels())
testing("spacetravel chose [nz],[ny],[nz] in sector [TM] @ ([TM.x],[TM.y],[TM.z])")
@@ -143,5 +167,7 @@
var/mob/D = A
if(D.pulling)
D.pulling.forceMove(dest)
else
to_world("CANARY: Could not move [A] to [nx], [ny], [nz]: [dest ? "[dest]" : "null"]")
M.cleanup()