-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Remove Contact Slowdown when Weightless or in the Air #33299
base: master
Are you sure you want to change the base?
Conversation
Even if this buffs flyers it doesn't make sense to be slowed by glue or affected by ice (the latter probably needs to be checked out here or another PR) |
I've done some testing with ice and it seems to be a non-issue; it does not affect entities that are weightless or in the air. |
Content.Shared/Movement/Components/SpeedModifierContactsComponent.cs
Outdated
Show resolved
Hide resolved
public float SprintSpeedModifier = 1.0f; | ||
|
||
[DataField("affectAirborne"), ViewVariables(VVAccess.ReadWrite)] | ||
[AutoNetworkedField] |
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.
Do you understand why this AutoNetworkedField is needed, or are you just copying from the rest of the variables?
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.
It's my understanding that [AutoNetworkedField] is needed when a field should be handled by the server while being automatically replicated to clients. If it wasn't already obvious, I'm new to contributing, so please do correct me if I'm wrong.
Co-authored-by: Ed <[email protected]>
public float SprintSpeedModifier = 1.0f; | ||
|
||
[DataField, ViewVariables(VVAccess.ReadWrite)] |
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.
[DataField, ViewVariables(VVAccess.ReadWrite)] | |
[DataField] |
DataField
includes ViewVariables(VVAccess.ReadWrite)
nowadays. Old files still do it manually, but it is not needed anymore.
Also add documentation for the datafield. I know the other ones aren't documented either, but that does not mean that you cannot do better :)
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.
Thanks for the info, I've made the suggested change. Also, I took the liberty of cleaning things up and adding in the missing documentation throughout, I hope that's okay!
// unless the entity applying the contact speed modifier is explicitly set to affect airborne entities | ||
// entities that are weightless or in the air, i.e. no gravity or flying mobs, should not be affected by contact speed modifiers | ||
if (!slowContactsComponent.AffectAirborne && (_gravity.IsWeightless(uid) || physicsComponent.BodyStatus == BodyStatus.InAir)) | ||
continue; |
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.
You should cache this isweightless check somewhere so it isn't re-checked for every contact as it's expensive + pass the physicscomponent in. Realistically you could bypass this entire loop as is.
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.
Done, let me know if it's alright now or still needs further changes.
About the PR
Removes the application of contact slowdowns from puddles (i.e. glue, slime, etc.) when entities are weightless or in the air.
Why / Balance
Currently, contact slowdowns from puddles (i.e. glue, slime, etc.) apply even when entities are weightless or in the air, impacting both players under zero gravity and flying mobs such as Space Dragons and Space Carp. It does not make sense for ground-based slowdowns to affect weightless or flying entities.
I recognize that there exists minor balance implications as this PR slightly buffs the movement of all flying mobs, as well as reduces the utility of space glue in zero gravity situations, but I believe that such buffs are sufficiently minor to warrant a change that more intuitively aligns contact slowdowns with in-game physics.
Technical details
Media
Weightless.mp4
FlyingMobs.mp4
Requirements
Breaking changes
Changelog
🆑 Vexerot