diff --git a/Content.Shared/Movement/Components/AffectAirborneMovementComponent.cs b/Content.Shared/Movement/Components/AffectAirborneMovementComponent.cs new file mode 100644 index 00000000000000..98efb55ca9ee33 --- /dev/null +++ b/Content.Shared/Movement/Components/AffectAirborneMovementComponent.cs @@ -0,0 +1,11 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Movement.Components; + +/// +/// On entities that apply contact speed modifiers to airborne entities, e.g. flying mobs. +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class AffectAirborneMovementComponent : Component +{ +} diff --git a/Content.Shared/Movement/Systems/SpeedModifierContactsSystem.cs b/Content.Shared/Movement/Systems/SpeedModifierContactsSystem.cs index 089fbbf924579c..00a927f63ceed9 100644 --- a/Content.Shared/Movement/Systems/SpeedModifierContactsSystem.cs +++ b/Content.Shared/Movement/Systems/SpeedModifierContactsSystem.cs @@ -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; @@ -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!; @@ -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(ent) && (_gravity.IsWeightless(uid) || physicsComponent.BodyStatus == BodyStatus.InAir)) + continue; + walkSpeed += slowContactsComponent.WalkSpeedModifier; sprintSpeed += slowContactsComponent.SprintSpeedModifier; speedModified = true; diff --git a/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml b/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml index e6b81e7ce40b7c..6dfbfdb5843dd2 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml @@ -10,6 +10,7 @@ - type: Transform anchored: true - type: Physics + - type: AffectAirborneMovement - type: Kudzu - type: GrowingKudzu - type: ActiveEdgeSpreader