-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port /tg/ move manager, drift and jetpack components. #27698
Port /tg/ move manager, drift and jetpack components. #27698
Conversation
This pull request seems to be stale as there have been no changes in 14 days, please make changes within 7 days or the PR will be closed. If you believe this is a mistake, please inform a development team member on Discord. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TM of this PR has been successful and problem free for awhile now. Anything smaller bugs due to edge cases can be addressed after merge.
Approved.
Recreation of #26637 because I can't reopen it due to a force-push or something. Note that /tg/ has moved away from the spacedrift component as of tgstation/tgstation#84869 in favor of more sophisticated newtonian physics in space; my goal here is to unblock all the movement code needed for AI controllers, not to have the latest-and-greatest version of inertial movement.
What Does This PR Do
This PR ports /tg/'s move_manager API, a replacement for use of the native BYOND
walk
procs. It introduces movement subsystems, which can be used for processing different kinds of movements, adding one for most atom movement and one for items drifting in space.Two new components are introduced:
The port comprises major pieces from these PRs:
move_manager was initially implemented as an SS, but /tg/ appears to be moving away from allowing SSes which don't fire, so it is now a global datum
GLOB.move_manager
(just for ease of porting, I don't necessarily agree with the move).Many signals are added.
Something which may be contentious is the glide_size_multiplier, a global which scales glide time based on TD. This may affect the appearance of gliding objects unrelated to movement but will require more testing.
I've had to step through a lot of this code line by line to get it to work, so if you think something needs more documentation, let me know and I should have a good enough understanding to add it.
I would have liked this to be more atomic but I couldn't find a good way to separate the various implementation work without distrusting the result.
Why It's Good For The Game
As the original PR states:
This puts control of movement in userspace and allows for more flexibility. As can be seen, multiple movement subsystems can exist in order to allow for prioritizing or different firing times (in this implementation, we have spacedrift as a separate manager versus everything else).
It's also a pseudo-prerequisite to basic mobs, again attempting to keep the work of porting that as atomic as possible by adding the beneficial dependencies separately.
For other benefits of this approach, see the code that's cleaned up in:
/mob/living/carbon/human/Process_Spacemove
which was coupled with modsuit jetpack behavior;inertia_dir
on every item moving around;sleep
-dependent code as in/obj/item/extinguisher/mini/nozzle/afterattack
,/obj/item/reagent_containers/spray
, and/obj/effect/decal/cleanable/blood/gibs/proc/streak
, among othersHow it Works
Cribbing from the original PR again:
TL;DR, the move_manager gets passed movement instructions attached to atoms in the form of move_loop datums and manages the work of moving things.
This provides mostly drop-in replacements for the `walk()` procs
walk(0)
->GLOB.move_manager.stop_looping()
walk()
->GLOB.move_manager.move()
walk_to()
->GLOB.move_manager.move_to()
walk_towards()
->GLOB.move_manager.home_onto()
andGLOB.move_manager.move_towards_legacy()
, check the documentation to see which you like betterwalk_away()
->GLOB.move_manager.move_away()
walk_rand()
->GLOB.move_manager.move_rand()
is random walk,GLOB.move_manager.move_to_rand()
is walk to a random placeIt also provides some signals for handling the continuation and stopping of movement, which could be helpful in the future.
Testing
Testing requires checking the behavior of everything that's had its
walk
proc usage replaced or which has been moved to the /drift component.This will require TMing especially when it comes to handling lots of moving things at once (e.g. a bunch of stuff drifting in space while someone is trying to fight Bubblegum), though, to be clear, I don't anticipate issues in such scenarios.
Known Issues
Declaration
Changelog
Despite the relatively invasive nature of this change, this should have no player-facing changes, except for to improve performance. If there's any change or discrepancy in movespeed, throw speed, pull speed, projectiles, etc., it is a regression.
NPFC