Files
Delta-v/Content.Shared/_DV/Carrying/CarryingSlowdownSystem.cs
T
deltanedasanddeltanedas ec94579ebc the great namespace refactor (#2574)
* refactor DeltaV/deltav resources to _DV

* change DeltaV namespaces to _DV

* add space before all DeltaV comments

* update xamls

* fix and move arena parallax to _DV

* more fix

* refactor even more stuff

* fix the grid fills

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
2025-01-01 07:50:34 +00:00

30 lines
909 B
C#

using Content.Shared.Movement.Systems;
namespace Content.Shared._DV.Carrying;
public sealed class CarryingSlowdownSystem : EntitySystem
{
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CarryingSlowdownComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMoveSpeed);
}
public void SetModifier(Entity<CarryingSlowdownComponent?> ent, float modifier)
{
ent.Comp ??= EnsureComp<CarryingSlowdownComponent>(ent);
ent.Comp.Modifier = modifier;
Dirty(ent, ent.Comp);
_movementSpeed.RefreshMovementSpeedModifiers(ent);
}
private void OnRefreshMoveSpeed(Entity<CarryingSlowdownComponent> ent, ref RefreshMovementSpeedModifiersEvent args)
{
args.ModifySpeed(ent.Comp.Modifier, ent.Comp.Modifier);
}
}