diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index ab6b4a9f7d..470c153086 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -828,15 +828,25 @@ proc/GaussRandRound(var/sigma,var/roundto) SX.air.copy_from(ST.zone.air) ST.zone.remove(ST) + var/z_level_change = FALSE + if(T.z != X.z) + z_level_change = TRUE + //Move the objects. Not forceMove because the object isn't "moving" really, it's supposed to be on the "same" turf. for(var/obj/O in T) O.loc = X O.update_light() + if(z_level_change) // The objects still need to know if their z-level changed. + O.onTransitZ(T.z, X.z) //Move the mobs unless it's an AI eye or other eye type. for(var/mob/M in T) if(istype(M, /mob/observer/eye)) continue // If we need to check for more mobs, I'll add a variable M.loc = X + + if(z_level_change) // Same goes for mobs. + M.onTransitZ(T.z, X.z) + if(istype(M, /mob/living)) var/mob/living/LM = M LM.check_shadow() // Need to check their Z-shadow, which is normally done in forceMove(). diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 5f91ad7091..66c219293e 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -33,6 +33,11 @@ var/list/starts_with /obj/structure/closet/Initialize() + ..() + // Closets need to come later because of spawners potentially creating objects during init. + return INITIALIZE_HINT_LATELOAD + +/obj/structure/closet/LateInitialize() . = ..() if(starts_with) create_objects_in_loc(src, starts_with)