Files
Bubberstation/code/__DEFINES/movement_info.dm
SkyratBot 0cecac1d43 [MIRROR] Canonical Movement (#26995)
* Canonical Movement (#82085)

## About The Pull Request

- https://github.com/DaedalusDock/daedalusdock/pull/892
Currently, TG's movement chain is not canonical, meaning movement can
resolve in an order that doesn't actually represent what it going on.
For example, if something inside of an Entered() call would move the
currently moving object, it resolves in this order:

1. Original Move
2. Intercepted Move
3. Intercepted Moved
4. Original Moved

This makes Moved() unreliable at tracking things like spatial grid
locations. This is a massive problem.

This PR introduces `active_movement`, a list containing arguments for
`Moved()`. At the start of `Move()` and `doMove()`, if the list is
present, it will call Moved(), concluding the original movement, before
proceeding. The original `Move()` call will not end in `Moved()`, due to
`active_movement` being null.

This is touching some of the most important code in the game and needs
extensive testing.

* Canonical Movement

---------

Co-authored-by: Kapu1178 <75460809+Kapu1178@users.noreply.github.com>
2024-03-23 16:45:08 -04:00

22 lines
592 B
Plaintext

#define ACTIVE_MOVEMENT_OLDLOC 1
#define ACTIVE_MOVEMENT_DIRECTION 2
#define ACTIVE_MOVEMENT_FORCED 3
#define ACTIVE_MOVEMENT_OLDLOCS 4
/// The arguments of this macro correspond directly to the argument order of /atom/movable/proc/Moved
#define SET_ACTIVE_MOVEMENT(_old_loc, _direction, _forced, _oldlocs) \
active_movement = list( \
_old_loc, \
_direction, \
_forced, \
_oldlocs, \
)
/// Finish any active movements
#define RESOLVE_ACTIVE_MOVEMENT \
if(active_movement) { \
var/__move_args = active_movement; \
active_movement = null; \
Moved(arglist(__move_args)); \
}