From ee3720b1516957886a71541c8d3a2b0802c652c8 Mon Sep 17 00:00:00 2001 From: Contrabang <91113370+Contrabang@users.noreply.github.com> Date: Thu, 19 Jan 2023 12:52:25 -0500 Subject: [PATCH] Fixes countdowns being out of movement sync with their atom (#20219) * countdowns move when their attached atom moves * fallback --- code/modules/countdown/countdown.dm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/code/modules/countdown/countdown.dm b/code/modules/countdown/countdown.dm index 0db53b47706..34d8653ca99 100644 --- a/code/modules/countdown/countdown.dm +++ b/code/modules/countdown/countdown.dm @@ -17,6 +17,7 @@ /obj/effect/countdown/Initialize(mapload) . = ..() attach(loc) + RegisterSignal(attached_to, COMSIG_MOVABLE_MOVED, PROC_REF(countdown_on_move)) /obj/effect/countdown/examine(mob/user) . = ..() @@ -37,14 +38,19 @@ STOP_PROCESSING(SSfastprocess, src) started = FALSE +/// Get the value from our atom /obj/effect/countdown/proc/get_value() - // Get the value from our atom return +/obj/effect/countdown/proc/countdown_on_move() + SIGNAL_HANDLER + forceMove(get_turf(attached_to)) + /obj/effect/countdown/process() if(!attached_to || QDELETED(attached_to)) qdel(src) - forceMove(get_turf(attached_to)) + if(!isturf(attached_to.loc)) // When in crates, lockers, etc. countdown_on_move wont be called. This is our backup + forceMove(get_turf(attached_to)) var/new_val = get_value() if(new_val == displayed_text) return