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:
9
Content.Shared/Body/Events/BleedModifierEvent.cs
Normal file
9
Content.Shared/Body/Events/BleedModifierEvent.cs
Normal 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);
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user