Фикс логики лечения кровотечения
This commit is contained in:
@@ -1,21 +1,23 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Chemistry.Containers.EntitySystems;
|
||||
using Content.Server.Medical.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Medical;
|
||||
using Content.Shared.Mobs;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Random;
|
||||
@@ -34,7 +36,7 @@ public sealed class HealingSystem : EntitySystem
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
||||
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -70,7 +72,6 @@ public sealed class HealingSystem : EntitySystem
|
||||
_bloodstreamSystem.TryModifyBleedAmount(entity.Owner, healing.BloodlossModifier);
|
||||
if (isBleeding != bloodstream.BleedAmount > 0)
|
||||
{
|
||||
dontRepeat = true;
|
||||
_popupSystem.PopupEntity(Loc.GetString("medical-item-stop-bleeding"), entity, args.User);
|
||||
}
|
||||
}
|
||||
@@ -114,7 +115,7 @@ public sealed class HealingSystem : EntitySystem
|
||||
_audio.PlayPvs(healing.HealingEndSound, entity.Owner, AudioHelpers.WithVariation(0.125f, _random).WithVolume(1f));
|
||||
|
||||
// Logic to determine the whether or not to repeat the healing action
|
||||
args.Repeat = (HasDamage(entity.Comp, healing) && !dontRepeat);
|
||||
args.Repeat = ((HasDamage(entity.Comp, healing) || HasBleedingToHeal(entity, healing)) && !dontRepeat); // WD added HasBleedingToHeal()
|
||||
if (!args.Repeat && !dontRepeat)
|
||||
_popupSystem.PopupEntity(Loc.GetString("medical-item-finished-using", ("item", args.Used)), entity.Owner, args.User);
|
||||
args.Handled = true;
|
||||
@@ -172,6 +173,7 @@ public sealed class HealingSystem : EntitySystem
|
||||
return false;
|
||||
|
||||
var anythingToDo =
|
||||
HasBleedingToHeal(target, component) || // WD Edit
|
||||
HasDamage(targetDamage, component) ||
|
||||
component.ModifyBloodLevel > 0 // Special case if healing item can restore lost blood...
|
||||
&& TryComp<BloodstreamComponent>(target, out var bloodstream)
|
||||
@@ -189,6 +191,12 @@ public sealed class HealingSystem : EntitySystem
|
||||
|
||||
var isNotSelf = user != target;
|
||||
|
||||
if (isNotSelf)
|
||||
{
|
||||
var msg = Loc.GetString("medical-item-popup-target", ("user", Identity.Entity(user, EntityManager)), ("item", uid));
|
||||
_popupSystem.PopupEntity(msg, target, target, PopupType.Medium);
|
||||
}
|
||||
|
||||
var delay = isNotSelf
|
||||
? component.Delay
|
||||
: component.Delay * GetScaledHealingPenalty(user, component);
|
||||
@@ -227,4 +235,21 @@ public sealed class HealingSystem : EntitySystem
|
||||
var modifier = percentDamage * (component.SelfHealPenaltyMultiplier - 1) + 1;
|
||||
return Math.Max(modifier, 1);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// WD.
|
||||
/// </summary>
|
||||
private bool HasBleedingToHeal(EntityUid target, HealingComponent healing)
|
||||
{
|
||||
if (healing.BloodlossModifier == float.NegativeZero)
|
||||
return false;
|
||||
|
||||
if (!TryComp<BloodstreamComponent>(target, out var bloodstream))
|
||||
return false;
|
||||
|
||||
var isBleeding = bloodstream.BleedAmount > 0;
|
||||
|
||||
return isBleeding;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
medical-item-finished-using = Вы закончили исцеление с помощью { $item }
|
||||
medical-item-cant-use = Нет никаких повреждений, которые вы могли бы залечить с помощью { $item }
|
||||
medical-item-stop-bleeding = Оно перестало кровоточить
|
||||
medical-item-stop-bleeding = Кровотечение было остановлено
|
||||
medical-item-popup-target = { CAPITALIZE($user) } пытается лечить вас при помощи { $item }!
|
||||
|
||||
Reference in New Issue
Block a user