Basic bleeding mechanics (#6710)

This commit is contained in:
mirrorcult
2022-02-17 15:00:41 -07:00
committed by GitHub
parent 56b2041b12
commit a57d78a3f2
29 changed files with 510 additions and 48 deletions

View File

@@ -18,6 +18,14 @@ namespace Content.Server.Medical.Components
[ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier Damage = default!;
/// <remarks>
/// This should generally be negative,
/// since you're, like, trying to heal damage.
/// </remarks>
[DataField("bloodlossModifier")]
[ViewVariables(VVAccess.ReadWrite)]
public float BloodlossModifier = 0.0f;
/// <remarks>
/// The supported damage types are specified using a <see cref="DamageContainerPrototype"/>s. For a
/// HealingComponent this filters what damage container type this component should work on. If null,

View File

@@ -1,5 +1,6 @@
using System.Threading;
using Content.Server.Administration.Logs;
using Content.Server.Body.Systems;
using Content.Server.DoAfter;
using Content.Server.Medical.Components;
using Content.Server.Stack;
@@ -17,6 +18,7 @@ public sealed class HealingSystem : EntitySystem
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly AdminLogSystem _logs = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfter = default!;
[Dependency] private readonly StackSystem _stacks = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
@@ -37,6 +39,12 @@ public sealed class HealingSystem : EntitySystem
if (component.DamageContainerID is not null &&
!component.DamageContainerID.Equals(component.DamageContainerID)) return;
if (args.Component.BloodlossModifier != 0)
{
// Heal some bloodloss damage.
_bloodstreamSystem.TryModifyBleedAmount(uid, args.Component.BloodlossModifier);
}
var healed = _damageable.TryChangeDamage(uid, args.Component.Damage, true);
// Reverify that we can heal the damage.