private void OnRefreshMoveSpeed(EntityUid uid, ClothingSpeedModifierComponent component, RefreshMovementSpeedModifiersEvent args) { if (!component.Enabled) { return; } args.ModifySpeed(component.WalkModifier, component.SprintModifier); }
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 (_container.TryGetContainingContainer(uid, out var container)) { _movementSpeed.RefreshMovementSpeedModifiers(container.Owner); } } }
// Event handlers private void OnGetState(EntityUid uid, ClothingSpeedModifierComponent component, ref ComponentGetState args) { args.State = new ClothingSpeedModifierComponentState(component.WalkModifier, component.SprintModifier, component.Enabled); }