]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Added Hemophilia Trait (#38224)
authorTheFlyingSentry <AFlyingSentry@gmail.com>
Thu, 21 Aug 2025 01:02:54 +0000 (21:02 -0400)
committerGitHub <noreply@github.com>
Thu, 21 Aug 2025 01:02:54 +0000 (03:02 +0200)
Co-authored-by: ScarKy0 <scarky0@onet.eu>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Content.Shared/Body/Events/BleedModifierEvent.cs [new file with mode: 0644]
Content.Shared/Body/Systems/SharedBloodstreamSystem.cs
Content.Shared/Traits/Assorted/HemophiliaComponent.cs [new file with mode: 0644]
Content.Shared/Traits/Assorted/HemophiliaSystem.cs [new file with mode: 0644]
Resources/Locale/en-US/traits/traits.ftl
Resources/Prototypes/Entities/Mobs/Player/clone.yml
Resources/Prototypes/Traits/disabilities.yml

diff --git a/Content.Shared/Body/Events/BleedModifierEvent.cs b/Content.Shared/Body/Events/BleedModifierEvent.cs
new file mode 100644 (file)
index 0000000..c836738
--- /dev/null
@@ -0,0 +1,9 @@
+namespace Content.Shared.Body.Events;
+
+/// <summary>
+/// Raised on an entity before they bleed to modify the amount.
+/// </summary>
+/// <param name="BleedAmount">The amount of blood the entity will lose.</param>
+/// <param name="BleedReductionAmount">The amount of bleed reduction that will happen.</param>
+[ByRefEvent]
+public record struct BleedModifierEvent(float BleedAmount, float BleedReductionAmount);
index 182cdb47d36b90957ef38bf01a6832b01c3286a5..7db9f42280ca69610b5d172944ebee8c867d1f43 100644 (file)
@@ -81,10 +81,14 @@ public abstract class SharedBloodstreamSystem : EntitySystem
             // as well as stop their bleeding to a certain extent.
             if (bloodstream.BleedAmount > 0)
             {
+                var ev = new BleedModifierEvent(bloodstream.BleedAmount, bloodstream.BleedReductionAmount);
+                RaiseLocalEvent(uid, ref ev);
+
                 // Blood is removed from the bloodstream at a 1-1 rate with the bleed amount
-                TryModifyBloodLevel((uid, bloodstream), -bloodstream.BleedAmount);
+                TryModifyBloodLevel((uid, bloodstream), -ev.BleedAmount);
+
                 // Bleed rate is reduced by the bleed reduction amount in the bloodstream component.
-                TryModifyBleedAmount((uid, bloodstream), -bloodstream.BleedReductionAmount);
+                TryModifyBleedAmount((uid, bloodstream), -ev.BleedReductionAmount);
             }
 
             // deal bloodloss damage if their blood level is below a threshold.
diff --git a/Content.Shared/Traits/Assorted/HemophiliaComponent.cs b/Content.Shared/Traits/Assorted/HemophiliaComponent.cs
new file mode 100644 (file)
index 0000000..208883f
--- /dev/null
@@ -0,0 +1,16 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Traits.Assorted;
+
+/// <summary>
+/// This component is used for the Hemophilia Trait, it reduces the passive bleed stack reduction amount so entities with it bleed for longer.
+/// </summary>
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
+public sealed partial class HemophiliaComponent : Component
+{
+    /// <summary>
+    /// What multiplier should be applied to the BleedReduction when an entity bleeds?
+    /// </summary>
+    [DataField, AutoNetworkedField]
+    public float HemophiliaBleedReductionMultiplier = 0.33f;
+}
diff --git a/Content.Shared/Traits/Assorted/HemophiliaSystem.cs b/Content.Shared/Traits/Assorted/HemophiliaSystem.cs
new file mode 100644 (file)
index 0000000..53f6609
--- /dev/null
@@ -0,0 +1,16 @@
+using Content.Shared.Body.Events;
+
+namespace Content.Shared.Traits.Assorted;
+
+public sealed class HemophiliaSystem : EntitySystem
+{
+    public override void Initialize()
+    {
+        SubscribeLocalEvent<HemophiliaComponent, BleedModifierEvent>(OnBleedModifier);
+    }
+
+    private void OnBleedModifier(Entity<HemophiliaComponent> ent, ref BleedModifierEvent args)
+    {
+        args.BleedReductionAmount *= ent.Comp.HemophiliaBleedReductionMultiplier;
+    }
+}
index f4c51d863e066ca5c3dc359c385e26c812dec8af..3895ce162d3b33ef3af20da8fd43619096a0fa91 100644 (file)
@@ -66,5 +66,8 @@ trait-spanish-desc = Hola señor, donde esta la biblioteca.
 trait-painnumbness-name = Numb
 trait-painnumbness-desc = You lack any sense of feeling pain, being unaware of how hurt you may be.
 
+trait-hemophilia-name = Hemophilia
+trait-hemophilia-desc = Your body fails to make blood clots.
+
 trait-impaired-mobility-name = Impaired Mobility
 trait-impaired-mobility-desc = You have difficulty moving without a mobility aid.
index 98d99d7321d8975303ba3183e84d8f205461b0ca..5c59f8274443b5636626e33224e562b9c2a35a2d 100644 (file)
@@ -16,6 +16,7 @@
   # traits
   - BlackAndWhiteOverlay
   - Clumsy
+  - Hemophilia
   - ImpairedMobility
   # - LegsParalyzed (you get healed)
   - LightweightDrunk
index 0bb6f0da3c647c04804e26662b4ecf7e92ae6ab8..c5356149f2b2b90342b375515af8ab36ea193c12 100644 (file)
   components:
   - type: PainNumbness
 
+- type: trait
+  id: Hemophilia
+  name: trait-hemophilia-name
+  description: trait-hemophilia-desc
+  category: Disabilities
+  components:
+  - type: Hemophilia
+
 - type: trait
   id: ImpairedMobility
   name: trait-impaired-mobility-name