Merge pull request #12293 from Heroman3003/11743-fix

11743 fix
This commit is contained in:
Casey
2022-02-19 19:07:24 -05:00
committed by CHOMPStation2
parent 5baec6eb8a
commit f89834cd72
2 changed files with 24 additions and 3 deletions

View File

@@ -14,6 +14,9 @@
// But pick an empty z level to use
map_z += global.using_map.get_empty_zlevel()
. = ..()
if(!map_z[1])
log_and_message_admins("Could not create empty sector at [x], [y]. No available z levels to allocate.")
return INITIALIZE_HINT_QDEL
testing("Temporary sector at [x],[y],[z] was created, corresponding zlevel is [english_list(map_z)].")
/obj/effect/overmap/visitable/sector/temporary/Destroy()
@@ -22,6 +25,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 +50,10 @@
var/obj/effect/overmap/visitable/sector/temporary/res = locate() in overmap_turf
if(istype(res))
return res
return new /obj/effect/overmap/visitable/sector/temporary(overmap_turf)
res = new /obj/effect/overmap/visitable/sector/temporary(overmap_turf)
if(QDELETED(res))
res = null
return res
/atom/movable/proc/lost_in_space()
for(var/atom/movable/AM in contents)
@@ -130,8 +139,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 +154,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()