More blood tweaks (#6811)
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Server.Body.Components;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Server.HealthExaminable;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
@@ -21,6 +22,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly SpillableSystem _spillableSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
@@ -63,7 +65,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
// as well as stop their bleeding to a certain extent.
|
||||
if (bloodstream.BleedAmount > 0)
|
||||
{
|
||||
TryModifyBloodLevel(uid, (-bloodstream.BleedAmount) / 10, bloodstream);
|
||||
TryModifyBloodLevel(uid, (-bloodstream.BleedAmount) / 20, bloodstream);
|
||||
TryModifyBleedAmount(uid, -bloodstream.BleedReductionAmount, bloodstream);
|
||||
}
|
||||
|
||||
@@ -113,17 +115,28 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
if (bloodloss.Empty)
|
||||
return;
|
||||
|
||||
var oldBleedAmount = component.BleedAmount;
|
||||
var total = bloodloss.Total;
|
||||
var totalFloat = total.Float();
|
||||
TryModifyBleedAmount(uid, totalFloat, component);
|
||||
|
||||
var prob = Math.Clamp(totalFloat / 50, 0, 1);
|
||||
if (_robustRandom.Prob(prob))
|
||||
var healPopupProb = Math.Clamp(Math.Abs(totalFloat) / 25, 0, 1);
|
||||
if (totalFloat > 0 && _robustRandom.Prob(prob))
|
||||
{
|
||||
// This is gonna hurt.
|
||||
TryModifyBloodLevel(uid, (-total) / 5, component);
|
||||
SoundSystem.Play(Filter.Pvs(uid), component.InstantBloodSound.GetSound(), uid, AudioParams.Default);
|
||||
}
|
||||
else if (totalFloat < 0 && oldBleedAmount > 0 && _robustRandom.Prob(healPopupProb))
|
||||
{
|
||||
// Magically, this damage has healed some bleeding, likely
|
||||
// because it's burn damage that cauterized their wounds.
|
||||
|
||||
// We'll play a special sound and popup for feedback.
|
||||
SoundSystem.Play(Filter.Pvs(uid), component.BloodHealedSound.GetSound(), uid, AudioParams.Default);
|
||||
_popupSystem.PopupEntity(Loc.GetString("bloodstream-component-wounds-cauterized"), uid,
|
||||
Filter.Entities(uid));
|
||||
; }
|
||||
}
|
||||
|
||||
private void OnHealthBeingExamined(EntityUid uid, BloodstreamComponent component, HealthBeingExaminedEvent args)
|
||||
@@ -208,7 +221,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
return false;
|
||||
|
||||
component.BleedAmount += amount;
|
||||
component.BleedAmount = Math.Clamp(component.BleedAmount, 0, 40);
|
||||
component.BleedAmount = Math.Clamp(component.BleedAmount, 0, component.MaxBleedAmount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user