mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 04:57:57 +01:00
[MIRROR] Fixes a spurious runtime off the drift component [MDB IGNORE] (#15815)
* 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 * Fixes a spurious runtime off the drift component Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user