Dont refresh movespeed in clothing handler (#13398)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user