Added Hemophilia Trait (#38224)

Co-authored-by: ScarKy0 <scarky0@onet.eu>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
TheFlyingSentry
2025-08-20 21:02:54 -04:00
committed by GitHub
parent 96d3b4bb29
commit 3d0573e7c8
7 changed files with 59 additions and 2 deletions

View File

@@ -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);

View File

@@ -81,10 +81,14 @@ public abstract class SharedBloodstreamSystem : EntitySystem
// as well as stop their bleeding to a certain extent. // as well as stop their bleeding to a certain extent.
if (bloodstream.BleedAmount > 0) 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 // 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. // 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. // deal bloodloss damage if their blood level is below a threshold.

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -66,5 +66,8 @@ trait-spanish-desc = Hola señor, donde esta la biblioteca.
trait-painnumbness-name = Numb trait-painnumbness-name = Numb
trait-painnumbness-desc = You lack any sense of feeling pain, being unaware of how hurt you may be. 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-name = Impaired Mobility
trait-impaired-mobility-desc = You have difficulty moving without a mobility aid. trait-impaired-mobility-desc = You have difficulty moving without a mobility aid.

View File

@@ -16,6 +16,7 @@
# traits # traits
- BlackAndWhiteOverlay - BlackAndWhiteOverlay
- Clumsy - Clumsy
- Hemophilia
- ImpairedMobility - ImpairedMobility
# - LegsParalyzed (you get healed) # - LegsParalyzed (you get healed)
- LightweightDrunk - LightweightDrunk

View File

@@ -84,6 +84,14 @@
components: components:
- type: PainNumbness - type: PainNumbness
- type: trait
id: Hemophilia
name: trait-hemophilia-name
description: trait-hemophilia-desc
category: Disabilities
components:
- type: Hemophilia
- type: trait - type: trait
id: ImpairedMobility id: ImpairedMobility
name: trait-impaired-mobility-name name: trait-impaired-mobility-name