diff --git a/Content.Shared/Clothing/ClothingSpeedModifierSystem.cs b/Content.Shared/Clothing/ClothingSpeedModifierSystem.cs index d75310ea00..4ce63fbc81 100644 --- a/Content.Shared/Clothing/ClothingSpeedModifierSystem.cs +++ b/Content.Shared/Clothing/ClothingSpeedModifierSystem.cs @@ -53,16 +53,22 @@ public sealed class ClothingSpeedModifierSystem : EntitySystem private void OnHandleState(EntityUid uid, ClothingSpeedModifierComponent component, ref ComponentHandleState args) { - if (args.Current is ClothingSpeedModifierComponentState state) - { - component.WalkModifier = state.WalkModifier; - component.SprintModifier = state.SprintModifier; - component.Enabled = state.Enabled; + if (args.Current is not ClothingSpeedModifierComponentState state) + return; - if (_container.TryGetContainingContainer(uid, out var container)) - { - _movementSpeed.RefreshMovementSpeedModifiers(container.Owner); - } + var diff = component.Enabled != state.Enabled || + !MathHelper.CloseTo(component.SprintModifier, state.SprintModifier) || + !MathHelper.CloseTo(component.WalkModifier, state.WalkModifier); + + component.WalkModifier = state.WalkModifier; + component.SprintModifier = state.SprintModifier; + component.Enabled = state.Enabled; + + // Avoid raising the event for the container if nothing changed. + // We'll still set the values in case they're slightly different but within tolerance. + if (diff && _container.TryGetContainingContainer(uid, out var container)) + { + _movementSpeed.RefreshMovementSpeedModifiers(container.Owner); } }