-
-
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
refactor: Movement cross/uncross implementation. #26762
base: master
Are you sure you want to change the base?
refactor: Movement cross/uncross implementation. #26762
Conversation
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.
The performance implications of this look sick. I gave some of it a quick look, but there is a LOT. I'll probably try to come back to this down the line.
The one thing that strikes me is that this does feel much less intuitive than simply overriding Crossed()
as before. Do you think you could create some kind of developer documentation for this change that explains the difference between the old and new way of doing this? Maybe on the new documentation site.
I think it'd be worth listing out things like
- which procs are now off limits (partially or entirely)
- which signals should be used to replace them (possibly with their arguments), and in particular, how to interact with them, especially with the return types.
- A good example or two of how you might now use it, maybe with a comparison of the old way and the new way in order to show how the concepts have transferred.
The more I look at the changes, the more straightforward it feels, but I also say this as someone who has a reasonable understanding of our ECS. I also really appreciate that you've put a lot into this work and don't want to put too much more onto your plate, but I think having this would do dividends.
code/__DEFINES/movement_info.dm
Outdated
@@ -0,0 +1,21 @@ | |||
#define ACTIVE_MOVEMENT_OLDLOC 1 |
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.
Document these, please
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.
Whoops, don't need these in this PR. Removed.
I've added a new page of documentation on the relevant signals and what to use when. PTAL and let me know it it needs any improvements. |
Tested with sensors in crates, sensors in modsuits Tested new proximity component with firing projectiles at singularity Tested new proximity component with portable flashes Tested new proximity component with facehuggers
@@ -11,11 +11,19 @@ | |||
|
|||
var/scanning = FALSE | |||
var/timing = FALSE | |||
var/time = 10 | |||
COOLDOWN_DECLARE(timing_cd) |
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.
This doesn't change its behavior, right? Was this original variable in seconds, ds, or processing ticks?
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.
I just did some extra testing. As far as I can tell, the original sensor cooldown is 10 ticks. I'm almost positive I ported the behavior correctly, both for the sensor cooldown and the arming timer. There's also "cooldown", which is not related to the timing countdown, meant to prevent spamming the sensor, which is part of the parent proc /obj/item/assembly/proc/process_cooldown()
, and was already on a timer so the behavior there shouldn't have changed either.
This reverts commit 9814f98.
What Does This PR Do
This PR refactors several aspects of movement code. It provides a replacement implementation for
/atom/movable/Move
which does not call the native implementation nor the various/Cross
//Uncross
native procs, instead relegating this behavior to signal handlers. It introduces theconnect_loc
component, which handles crossing-style signals for objects by reregistering the specified signals onto locations that the parent moves to, andconnect_loc_behalf
, which does the same thing asconnect_loc
except on behalf of another listener.This PR is an amalgamation of several /tg/ PRs, including but not limited to:
Why It's Good For The Game
This implementation clears the way for #26637, another important refactor.
Many native BYOND procs are called millions of times a round for no reason. This implementation shortcircuits millions of these calls.
Overall this is a much cleaner implementation and easier to reason about, surprisingly.
Testing
In progorororereressss.
Declaration
Changelog
NPFC