diff --git a/Content.Server/Medical/Components/HealingComponent.cs b/Content.Server/Medical/Components/HealingComponent.cs
index 401a20cff0..25dbf88cec 100644
--- a/Content.Server/Medical/Components/HealingComponent.cs
+++ b/Content.Server/Medical/Components/HealingComponent.cs
@@ -39,6 +39,12 @@ namespace Content.Server.Medical.Components
[DataField("delay")]
public float Delay = 3f;
+ ///
+ /// Delay multiplier when healing yourself.
+ ///
+ [DataField("selfHealPenaltyMultiplier")]
+ public float SelfHealPenaltyMultiplier = 3f;
+
public CancellationTokenSource? CancelToken = null;
///
diff --git a/Content.Server/Medical/HealingSystem.cs b/Content.Server/Medical/HealingSystem.cs
index 5e7f6c265a..d3664d4ad9 100644
--- a/Content.Server/Medical/HealingSystem.cs
+++ b/Content.Server/Medical/HealingSystem.cs
@@ -4,12 +4,12 @@ using Content.Server.Body.Systems;
using Content.Server.DoAfter;
using Content.Server.Medical.Components;
using Content.Server.Stack;
+using Content.Server.MobState;
using Content.Shared.Audio;
using Content.Shared.Damage;
using Content.Shared.Database;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
-using Content.Shared.MobState.Components;
using Content.Shared.Stacks;
using Robust.Shared.Audio;
using Robust.Shared.Player;
@@ -24,6 +24,7 @@ public sealed class HealingSystem : EntitySystem
[Dependency] private readonly DoAfterSystem _doAfter = default!;
[Dependency] private readonly StackSystem _stacks = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
+ [Dependency] private readonly MobStateSystem _mobStateSystem = default!;
public override void Initialize()
{
@@ -36,7 +37,7 @@ public sealed class HealingSystem : EntitySystem
private void OnHealingComplete(EntityUid uid, DamageableComponent component, HealingCompleteEvent args)
{
- if (TryComp(uid, out var state) && state.IsDead())
+ if (_mobStateSystem.IsDead(uid))
return;
if (TryComp(args.Component.Owner, out var stack) && stack.Count < 1) return;
@@ -97,12 +98,15 @@ public sealed class HealingSystem : EntitySystem
return false;
}
- if (TryComp(target, out var state) && state.IsDead())
+ if (_mobStateSystem.IsDead(target))
return false;
if (!TryComp(target, out var targetDamage))
return false;
+ if (targetDamage.TotalDamage == 0)
+ return false;
+
if (component.DamageContainerID is not null && !component.DamageContainerID.Equals(targetDamage.DamageContainerID))
return false;
@@ -122,7 +126,12 @@ public sealed class HealingSystem : EntitySystem
SoundSystem.Play(component.HealingBeginSound.GetSound(), Filter.Pvs(uid, entityManager:EntityManager), uid, AudioHelpers.WithVariation(0.125f).WithVolume(-5f));
}
- _doAfter.DoAfter(new DoAfterEventArgs(user, component.Delay, component.CancelToken.Token, target)
+ var delay = component.Delay;
+
+ if (user == target)
+ delay *= component.SelfHealPenaltyMultiplier;
+
+ _doAfter.DoAfter(new DoAfterEventArgs(user, delay, component.CancelToken.Token, target)
{
BreakOnUserMove = true,
BreakOnTargetMove = true,