[MIRROR] Fixes funky magic item teleportation [MDB IGNORE] (#10865)

* Fixes funky magic item teleportation (#64263)

Space drifting "listened" for moves outside of its expected range, and if it saw them it would self delete
The problem is it registered for this behavior in drifting_start(), which was intended to be called by the MOVELOOP_START signal

But because that signal was fired as a consequence of move() being called, we never registered the signal
So if you took an item out of your pack, when it hit the ground it would get the drifting component
Next tick it would be drift moved to its intended location, the move would "fail", and then it would stop
This lead to items being visually in your inventory, but not functionally
Which leads to a lot of really weird behavior

Oh and I added a var to moveloops that's just "are we running" to make solving this class of issue easier

* Fixes funky magic item teleportation

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-01-21 10:12:38 +00:00
committed by GitHub
co-authored by LemonInTheDark
parent 876cfcd8f0
commit 015020189b
2 changed files with 7 additions and 2 deletions
+3 -2
View File
@@ -18,13 +18,13 @@
if(!drifting_loop) //Really want to qdel here but can't
return COMPONENT_INCOMPATIBLE
RegisterSignal(movable_parent, COMSIG_MOVABLE_NEWTONIAN_MOVE, .proc/newtonian_impulse)
RegisterSignal(drifting_loop, COMSIG_MOVELOOP_START, .proc/drifting_start)
RegisterSignal(drifting_loop, COMSIG_MOVELOOP_STOP, .proc/drifting_stop)
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)
if(drifting_loop.running)
drifting_start(drifting_loop) // There's a good chance it'll autostart, gotta catch that
/datum/component/drift/Destroy()
inertia_last_loc = null
@@ -49,6 +49,7 @@
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)
/datum/component/drift/proc/drifting_stop()
SIGNAL_HANDLER