From 4d6e8caa850e1d50dd17a343471702fb6dea18c6 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Wed, 24 Aug 2022 20:25:31 -0700 Subject: [PATCH] Fixes a spurious runtime off the drift component (#69345) * Fixes a spurious runtime off the drift component If a loop is made non active, then we end up allowing for double applications of the component, which throws errors because the old component (and it's loop) still exist by that point. This resolves that --- code/datums/components/drift.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/datums/components/drift.dm b/code/datums/components/drift.dm index d73626b730a..5964d299252 100644 --- a/code/datums/components/drift.dm +++ b/code/datums/components/drift.dm @@ -33,6 +33,7 @@ RegisterSignal(drifting_loop, COMSIG_MOVELOOP_PREPROCESS_CHECK, .proc/before_move) RegisterSignal(drifting_loop, COMSIG_MOVELOOP_POSTPROCESS, .proc/after_move) RegisterSignal(drifting_loop, COMSIG_PARENT_QDELETING, .proc/loop_death) + RegisterSignal(movable_parent, COMSIG_MOVABLE_NEWTONIAN_MOVE, .proc/newtonian_impulse) if(drifting_loop.running) drifting_start(drifting_loop) // There's a good chance it'll autostart, gotta catch that @@ -76,7 +77,8 @@ SIGNAL_HANDLER var/atom/movable/movable_parent = parent inertia_last_loc = movable_parent.loc - drifting_loop.direction = inertia_direction + if(drifting_loop) + drifting_loop.direction = inertia_direction if(!inertia_direction) qdel(src) return COMPONENT_MOVABLE_NEWTONIAN_BLOCK @@ -86,7 +88,6 @@ var/atom/movable/movable_parent = parent inertia_last_loc = movable_parent.loc RegisterSignal(movable_parent, COMSIG_MOVABLE_MOVED, .proc/handle_move) - RegisterSignal(movable_parent, COMSIG_MOVABLE_NEWTONIAN_MOVE, .proc/newtonian_impulse) // We will use glide size to intuit how long to delay our loop's next move for // This way you can't ride two movements at once while drifting, since that'd be dumb as fuck RegisterSignal(movable_parent, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE, .proc/handle_glidesize_update) @@ -98,7 +99,7 @@ var/atom/movable/movable_parent = parent movable_parent.inertia_moving = FALSE ignore_next_glide = FALSE - UnregisterSignal(movable_parent, list(COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_NEWTONIAN_MOVE, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE, COMSIG_ATOM_NO_LONGER_PULLING)) + UnregisterSignal(movable_parent, list(COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_UPDATE_GLIDE_SIZE, COMSIG_ATOM_NO_LONGER_PULLING)) /datum/component/drift/proc/before_move(datum/source) SIGNAL_HANDLER @@ -126,7 +127,6 @@ /datum/component/drift/proc/loop_death(datum/source) SIGNAL_HANDLER drifting_loop = null - UnregisterSignal(parent, COMSIG_MOVABLE_NEWTONIAN_MOVE) /datum/component/drift/proc/handle_move(datum/source, old_loc) SIGNAL_HANDLER