mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-02-14 19:29:57 +01:00
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>
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Content.Shared.Clothing;
|
||||
|
||||
/// <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
|
||||
@@ -16,6 +16,13 @@ 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.
|
||||
|
||||
@@ -56,7 +56,7 @@ public sealed class ClothingSpeedModifierSystem : EntitySystem
|
||||
|
||||
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))
|
||||
@@ -114,6 +114,9 @@ public sealed class ClothingSpeedModifierSystem : EntitySystem
|
||||
|
||||
private void OnToggled(Entity<ClothingSpeedModifierComponent> ent, ref ItemToggledEvent args)
|
||||
{
|
||||
if (!ent.Comp.RequireActivated)
|
||||
return;
|
||||
|
||||
// make sentient boots slow or fast too
|
||||
_movementSpeed.RefreshMovementSpeedModifiers(ent);
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
- type: ClothingSpeedModifier
|
||||
walkModifier: 0.9
|
||||
sprintModifier: 0.9
|
||||
requireActivated: false
|
||||
- type: HeldSpeedModifier
|
||||
- type: TemperatureProtection
|
||||
heatingCoefficient: 0.1
|
||||
|
||||
Reference in New Issue
Block a user