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 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Movement.Components;

/// <summary>
/// On entities that apply contact speed modifiers to airborne entities, e.g. flying mobs.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class AffectAirborneMovementComponent : Component
{
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Shared.Inventory;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Events;
using Content.Shared.Gravity;
using Content.Shared.Slippery;
using Content.Shared.Whitelist;
using Robust.Shared.Physics.Components;
Expand All @@ -12,6 +13,7 @@ namespace Content.Shared.Movement.Systems;
public sealed class SpeedModifierContactsSystem : EntitySystem
{
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedGravitySystem _gravity = default!;
[Dependency] private readonly MovementSpeedModifierSystem _speedModifierSystem = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;

Expand Down Expand Up @@ -95,6 +97,11 @@ private void MovementSpeedCheck(EntityUid uid, SpeedModifiedByContactComponent c
if (_whitelistSystem.IsWhitelistPass(slowContactsComponent.IgnoreWhitelist, uid))
continue;

// entities that are weightless or in the air, i.e. no gravity or flying mobs, should not be affected by contact speed modifiers
// unless the entity applying the contact speed modifier has AffectAirborneMovementComponent
if (!HasComp<AffectAirborneMovementComponent>(ent) && (_gravity.IsWeightless(uid) || physicsComponent.BodyStatus == BodyStatus.InAir))
continue;

walkSpeed += slowContactsComponent.WalkSpeedModifier;
sprintSpeed += slowContactsComponent.SprintSpeedModifier;
speedModified = true;
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Objects/Misc/kudzu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- type: Transform
anchored: true
- type: Physics
- type: AffectAirborneMovement
- type: Kudzu
- type: GrowingKudzu
- type: ActiveEdgeSpreader
Expand Down
Loading