Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes z-mimic having destruction qdel timer when it shouldn't #11215

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions code/__DEFINES/zmimic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))) \
)


Expand Down
22 changes: 16 additions & 6 deletions code/modules/multiz/zmimic/mimic_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
Loading