diff --git a/code/__DEFINES/zmimic.dm b/code/__DEFINES/zmimic.dm index a56e30be3638b..ef5aa90b122d5 100644 --- a/code/__DEFINES/zmimic.dm +++ b/code/__DEFINES/zmimic.dm @@ -9,15 +9,17 @@ /// Is this movable visible from a turf that is mimicking below? Note: this does not necessarily mean *directly* below. #define MOVABLE_IS_BELOW_ZTURF(M) (\ - isturf(loc) && (TURF_IS_MIMICKING(loc:above) \ - || ((M:zmm_flags & ZMM_LOOKAHEAD) && ZM_INTERNAL_SCAN_LOOKAHEAD(M, above?:z_flags, Z_MIMIC_BELOW)) \ - || ((M:zmm_flags & ZMM_LOOKBESIDE) && ZM_INTERNAL_SCAN_LOOKBESIDE(M, above?:z_flags, Z_MIMIC_BELOW))) \ + isturf(M:loc) && isturf(M:loc:above) && ( \ + TURF_IS_MIMICKING(M:loc:above) \ + || ((M:zmm_flags & ZMM_LOOKAHEAD) && ZM_INTERNAL_SCAN_LOOKAHEAD(M, above?:z_flags, Z_MIMIC_BELOW)) \ + || ((M:zmm_flags & ZMM_LOOKBESIDE) && ZM_INTERNAL_SCAN_LOOKBESIDE(M, above?:z_flags, Z_MIMIC_BELOW))) \ ) /// Is this movable located on a turf that is mimicking below? Note: this does not necessarily mean *directly* on. #define MOVABLE_IS_ON_ZTURF(M) (\ - isturf(loc) && (TURF_IS_MIMICKING(loc:above) \ - || ((M:zmm_flags & ZMM_LOOKAHEAD) && ZM_INTERNAL_SCAN_LOOKAHEAD(M, z_flags, Z_MIMIC_BELOW)) \ - || ((M:zmm_flags & ZMM_LOOKBESIDE) && ZM_INTERNAL_SCAN_LOOKBESIDE(M, z_flags, Z_MIMIC_BELOW))) \ + isturf(M:loc) && (\ + TURF_IS_MIMICKING(M:loc) \ + || ((M:zmm_flags & ZMM_LOOKAHEAD) && ZM_INTERNAL_SCAN_LOOKAHEAD(M, z_flags, Z_MIMIC_BELOW)) \ + || ((M:zmm_flags & ZMM_LOOKBESIDE) && ZM_INTERNAL_SCAN_LOOKBESIDE(M, z_flags, Z_MIMIC_BELOW))) \ ) diff --git a/code/modules/multiz/zmimic/mimic_movable.dm b/code/modules/multiz/zmimic/mimic_movable.dm index 2710bbc6460eb..3d1483fd7a01e 100644 --- a/code/modules/multiz/zmimic/mimic_movable.dm +++ b/code/modules/multiz/zmimic/mimic_movable.dm @@ -16,10 +16,14 @@ return if (MOVABLE_IS_BELOW_ZTURF(src)) + if(bound_overlay.destruction_timer) + deltimer(bound_overlay.destruction_timer) + bound_overlay.destruction_timer = null SSzcopy.queued_overlays += bound_overlay bound_overlay.queued += 1 - else if (bound_overlay && !bound_overlay.destruction_timer) - bound_overlay.destruction_timer = QDEL_IN(bound_overlay, 10 SECONDS) + else + if(!bound_overlay.destruction_timer) + bound_overlay.destruction_timer = QDEL_IN(bound_overlay, 10 SECONDS) // Grabs a list of every openspace mimic that's directly or indirectly copying this object. Returns an empty list if none found. /atom/movable/proc/get_associated_mimics() @@ -194,13 +198,19 @@ if (destruction_timer) deltimer(destruction_timer) destruction_timer = null - else if (!destruction_timer) - destruction_timer = QDEL_IN(src, 10 SECONDS) + else + if (!destruction_timer) + destruction_timer = QDEL_IN(src, 10 SECONDS) // Called when the turf we're on is deleted/changed. /atom/movable/openspace/mimic/proc/owning_turf_changed() - if (!destruction_timer) - destruction_timer = QDEL_IN(src, 10 SECONDS) + if (MOVABLE_IS_BELOW_ZTURF(associated_atom)) + if (destruction_timer) + deltimer(destruction_timer) + destruction_timer = null + else + if (!destruction_timer) + destruction_timer = QDEL_IN(src, 10 SECONDS) // Get actual source atom when orbiting /atom/movable/openspace/mimic/get_orbitable()