/// <summary>
/// Modifies speed when worn and activated.
-/// Supports <c>ItemToggleComponent</c>.
+/// Supports <see cref="ItemToggleComponent"/>.
/// </summary>
[RegisterComponent, NetworkedComponent, Access(typeof(ClothingSpeedModifierSystem))]
public sealed partial class ClothingSpeedModifierComponent : Component
[DataField]
public float SprintModifier = 1.0f;
+ /// <summary>
+ /// Defines if the speed modifier requires <see cref="ItemToggleComponent"/> activation to apply.
+ /// This will have no effect without an <see cref="ItemToggleComponent"/> on the entity.
+ /// </summary>
+ [DataField]
+ public bool RequireActivated = true;
+
/// <summary>
/// An optional required standing state.
/// Set to true if you need to be standing, false if you need to not be standing, null if you don't care.
private void OnRefreshMoveSpeed(EntityUid uid, ClothingSpeedModifierComponent component, InventoryRelayedEvent<RefreshMovementSpeedModifiersEvent> args)
{
- if (!_toggle.IsActivated(uid))
+ if (component.RequireActivated && !_toggle.IsActivated(uid))
return;
if (component.Standing != null && !_standing.IsMatchingState(args.Owner, component.Standing.Value))
private void OnToggled(Entity<ClothingSpeedModifierComponent> ent, ref ItemToggledEvent args)
{
+ if (!ent.Comp.RequireActivated)
+ return;
+
// make sentient boots slow or fast too
_movementSpeed.RefreshMovementSpeedModifiers(ent);