Blood tweaks & fixes (#14648)
This commit is contained in:
@@ -15,6 +15,7 @@ using Content.Shared.Drunk;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Rejuvenate;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -31,13 +32,9 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
[Dependency] private readonly AudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedDrunkSystem _drunkSystem = default!;
|
||||
|
||||
// TODO here
|
||||
// Update over time. Modify bloodloss damage in accordance with (amount of blood / max blood level), and reduce bleeding over time
|
||||
// Sub to damage changed event and modify bloodloss if incurring large hits of slashing/piercing
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -82,7 +79,8 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
foreach (var bloodstream in EntityManager.EntityQuery<BloodstreamComponent>())
|
||||
var query = new EntityQueryEnumerator<BloodstreamComponent>();
|
||||
while (query.MoveNext(out var uid, out var bloodstream))
|
||||
{
|
||||
bloodstream.AccumulatedFrametime += frameTime;
|
||||
|
||||
@@ -91,7 +89,6 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
|
||||
bloodstream.AccumulatedFrametime -= bloodstream.UpdateInterval;
|
||||
|
||||
var uid = bloodstream.Owner;
|
||||
if (TryComp<MobStateComponent>(uid, out var state) && _mobStateSystem.IsDead(uid, state))
|
||||
continue;
|
||||
|
||||
@@ -103,7 +100,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
// as well as stop their bleeding to a certain extent.
|
||||
if (bloodstream.BleedAmount > 0)
|
||||
{
|
||||
TryModifyBloodLevel(uid, (-bloodstream.BleedAmount) / 20, bloodstream);
|
||||
TryModifyBloodLevel(uid, (-bloodstream.BleedAmount) / 10, bloodstream);
|
||||
TryModifyBleedAmount(uid, -bloodstream.BleedReductionAmount, bloodstream);
|
||||
}
|
||||
|
||||
@@ -149,6 +146,10 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
if (args.DamageDelta is null)
|
||||
return;
|
||||
|
||||
// definitely don't make them bleed if they got healed
|
||||
if (!args.DamageIncreased)
|
||||
return;
|
||||
|
||||
// TODO probably cache this or something. humans get hurt a lot
|
||||
if (!_prototypeManager.TryIndex<DamageModifierSetPrototype>(component.DamageBleedModifiers, out var modifiers))
|
||||
return;
|
||||
@@ -168,7 +169,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
if (totalFloat > 0 && _robustRandom.Prob(prob))
|
||||
{
|
||||
TryModifyBloodLevel(uid, (-total) / 5, component);
|
||||
SoundSystem.Play(component.InstantBloodSound.GetSound(), Filter.Pvs(uid), uid, AudioParams.Default);
|
||||
_audio.PlayPvs(component.InstantBloodSound, uid);
|
||||
}
|
||||
else if (totalFloat < 0 && oldBleedAmount > 0 && _robustRandom.Prob(healPopupProb))
|
||||
{
|
||||
@@ -176,7 +177,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
||||
// because it's burn damage that cauterized their wounds.
|
||||
|
||||
// We'll play a special sound and popup for feedback.
|
||||
SoundSystem.Play(component.BloodHealedSound.GetSound(), Filter.Pvs(uid), uid, AudioParams.Default);
|
||||
_audio.PlayPvs(component.BloodHealedSound, uid);
|
||||
_popupSystem.PopupEntity(Loc.GetString("bloodstream-component-wounds-cauterized"), uid,
|
||||
uid, PopupType.Medium);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user