From df1266e4dee52cadff50ec1a03cfb1dfa5fe61c8 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 29 May 2024 02:05:14 +0200 Subject: [PATCH] [MIRROR] Fix issues resulting from an elevated object being created inside of a non-turf atom (#27890) * Fix issues resulting from an elevated object being created inside of a non-turf atom (#83498) ## About The Pull Request If an elevated object is initialized inside of a non-turf atom, it'll still make the turf it is on elevated. Permanently. Which is weird. ## Why It's Good For The Game Randomly elevated turfs are bad. Bugs bad. ## Changelog :cl: fix: Fix a rare issue where a turf would remain permanently "elevated" if an elevated object was initialized inside of a non-turf object. /:cl: * Fix issues resulting from an elevated object being created inside of a non-turf atom --------- Co-authored-by: Lucy --- code/datums/elements/elevation.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/datums/elements/elevation.dm b/code/datums/elements/elevation.dm index 92fba97a094..b83548c6b5f 100644 --- a/code/datums/elements/elevation.dm +++ b/code/datums/elements/elevation.dm @@ -18,8 +18,9 @@ if(ismovable(target)) RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved)) - var/turf/turf = get_turf(target) - if(turf) + var/atom/atom_target = target + if(isturf(atom_target.loc)) + var/turf/turf = atom_target.loc if(!HAS_TRAIT(turf, TRAIT_TURF_HAS_ELEVATED_OBJ(pixel_shift))) RegisterSignal(turf, COMSIG_TURF_RESET_ELEVATION, PROC_REF(check_elevation)) RegisterSignal(turf, COMSIG_TURF_CHANGE, PROC_REF(pre_change_turf))