Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Vexerot
Copy link
Contributor

@Vexerot Vexerot commented Nov 13, 2024

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

  • Added a SharedGravitySystem dependency to SpeedModifierContactsSystem.cs to facilitate a weightless check.
  • Added a conditional return in the MovementSpeedCheck method; based on whether the entity is weightless or in the air.

Media

Weightless.mp4
FlyingMobs.mp4

Requirements

Breaking changes

Changelog

🆑 Vexerot

  • tweak: Entities that are weightless or in the air are no longer slowed by puddles.

@github-actions github-actions bot added the S: Needs Review Status: Requires additional reviews before being fully accepted label Nov 13, 2024
@K-Dynamic
Copy link
Contributor

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)

@SlamBamActionman SlamBamActionman added the S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. label Nov 14, 2024
@Vexerot
Copy link
Contributor Author

Vexerot commented Nov 14, 2024

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.

@TheShuEd TheShuEd added P3: Standard Priority: Default priority for repository items. D3: Low Difficulty: Some codebase knowledge required. T: Balance Change Type: Balance changes through direct value changes, or changes to mechanics that affect it A: General Interactions Area: General in-game interactions that don't relate to another area. size/XS Denotes a PR that changes 0-9 lines. and removed S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. labels Nov 14, 2024
@github-actions github-actions bot added size/S Denotes a PR that changes 10-99 lines. and removed size/XS Denotes a PR that changes 0-9 lines. labels Nov 15, 2024
@Vexerot Vexerot requested a review from TheShuEd November 15, 2024 01:21
public float SprintSpeedModifier = 1.0f;

[DataField("affectAirborne"), ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
Copy link
Member

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?

Copy link
Contributor Author

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.

@TheShuEd TheShuEd self-assigned this Nov 15, 2024
public float SprintSpeedModifier = 1.0f;

[DataField, ViewVariables(VVAccess.ReadWrite)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[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 :)

Copy link
Contributor Author

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!

@github-actions github-actions bot added size/M Denotes a PR that changes 100-999 lines. and removed size/S Denotes a PR that changes 10-99 lines. labels Nov 26, 2024
Comment on lines 100 to 103
// 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;
Copy link
Contributor

@metalgearsloth metalgearsloth Nov 26, 2024

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.

Copy link
Contributor Author

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.

@metalgearsloth metalgearsloth added S: Awaiting Changes Status: Changes are required before another review can happen and removed S: Needs Review Status: Requires additional reviews before being fully accepted labels Nov 26, 2024
@github-actions github-actions bot added S: Needs Review Status: Requires additional reviews before being fully accepted and removed S: Awaiting Changes Status: Changes are required before another review can happen labels Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: General Interactions Area: General in-game interactions that don't relate to another area. D3: Low Difficulty: Some codebase knowledge required. P3: Standard Priority: Default priority for repository items. S: Needs Review Status: Requires additional reviews before being fully accepted size/M Denotes a PR that changes 100-999 lines. T: Balance Change Type: Balance changes through direct value changes, or changes to mechanics that affect it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants