]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Improve ClothingSpeedModifier, Fix Paramedic Void Suit (#41820)
authorConnor Huffine <chuffine@gmail.com>
Wed, 10 Dec 2025 18:52:55 +0000 (13:52 -0500)
committerGitHub <noreply@github.com>
Wed, 10 Dec 2025 18:52:55 +0000 (18:52 +0000)
* 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>
Content.Shared/Clothing/ClothingSpeedModifierComponent.cs
Content.Shared/Clothing/ClothingSpeedModifierSystem.cs
Resources/Prototypes/Entities/Clothing/OuterClothing/softsuits.yml

index 8dc496ec25db00230f1957475bd3a9a22c8c7c1b..37f0a83eaa68da063dc9f44174a24dc53d03dedd 100644 (file)
@@ -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.
index 29f063c7fab821fa268d91255b8cf82264c9f33e..4c264ac375d7b3224fb3f21f003a6e2b64893ec8 100644 (file)
@@ -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);
 
index 7bf6ed1f0accaec46de223e3724987c6cf4cb484..761c0e715f93f2e2fdf980b85cb779b9f68cc50a 100644 (file)
   - type: ClothingSpeedModifier
     walkModifier: 0.9
     sprintModifier: 0.9
+    requireActivated: false
   - type: HeldSpeedModifier
   - type: TemperatureProtection
     heatingCoefficient: 0.1