Crawling Part 1: The Knockdownening (#36881)

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Co-authored-by: ScarKy0 <scarky0@onet.eu>
This commit is contained in:
Princess Cheeseballs
2025-07-19 16:54:42 -07:00
committed by GitHub
parent cfb0a95035
commit dec2d42a1d
60 changed files with 1595 additions and 220 deletions

View File

@@ -1,8 +1,7 @@
using System.Text.Json.Serialization.Metadata;
using Content.Shared.CCVar;
using Content.Shared.Inventory;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Events;
using Content.Shared.Standing;
using Robust.Shared.Configuration;
using Robust.Shared.Timing;
@@ -11,7 +10,7 @@ namespace Content.Shared.Movement.Systems
public sealed class MovementSpeedModifierSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!;
private float _frictionModifier;
private float _airDamping;
@@ -21,6 +20,8 @@ namespace Content.Shared.Movement.Systems
{
base.Initialize();
SubscribeLocalEvent<MovementSpeedModifierComponent, MapInitEvent>(OnModMapInit);
SubscribeLocalEvent<MovementSpeedModifierComponent, DownedEvent>(OnDowned);
SubscribeLocalEvent<MovementSpeedModifierComponent, StoodEvent>(OnStand);
Subs.CVar(_configManager, CCVars.TileFrictionModifier, value => _frictionModifier = value, true);
Subs.CVar(_configManager, CCVars.AirFriction, value => _airDamping = value, true);
@@ -41,6 +42,18 @@ namespace Content.Shared.Movement.Systems
Dirty(ent);
}
private void OnDowned(Entity<MovementSpeedModifierComponent> entity, ref DownedEvent args)
{
RefreshFrictionModifiers(entity);
RefreshMovementSpeedModifiers(entity);
}
private void OnStand(Entity<MovementSpeedModifierComponent> entity, ref StoodEvent args)
{
RefreshFrictionModifiers(entity);
RefreshMovementSpeedModifiers(entity);
}
public void RefreshWeightlessModifiers(EntityUid uid, MovementSpeedModifierComponent? move = null)
{
if (!Resolve(uid, ref move, false))