Files
space-station-14/Content.Shared/Clothing/ClothingSpeedModifierComponent.cs
Connor Huffine 4a460468d0 Improve ClothingSpeedModifier, Fix Paramedic Void Suit (#41820)
* Add RequireActivated bool

* Fix paramedic voidsuit

* Remove explicit check

This is actually unnecessarily verbose.

* Improve comment

* Update Content.Shared/Clothing/ClothingSpeedModifierSystem.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Add cref linking

* Change reference from system to component

* Fix missing closing tag before anyone notices

* Add clarity about when this field is used.

* Add early return if not affected by toggling

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2025-12-10 18:52:55 +00:00

46 lines
1.3 KiB
C#

using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Clothing;
/// <summary>
/// Modifies speed when worn and activated.
/// Supports <see cref="ItemToggleComponent"/>.
/// </summary>
[RegisterComponent, NetworkedComponent, Access(typeof(ClothingSpeedModifierSystem))]
public sealed partial class ClothingSpeedModifierComponent : Component
{
[DataField]
public float WalkModifier = 1.0f;
[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.
/// </summary>
[DataField]
public bool? Standing;
}
[Serializable, NetSerializable]
public sealed class ClothingSpeedModifierComponentState : ComponentState
{
public float WalkModifier;
public float SprintModifier;
public ClothingSpeedModifierComponentState(float walkModifier, float sprintModifier)
{
WalkModifier = walkModifier;
SprintModifier = sprintModifier;
}
}