diff --git a/Content.Server/Body/Components/BloodstreamComponent.cs b/Content.Server/Body/Components/BloodstreamComponent.cs index 11c02d86cd..50a652d9a3 100644 --- a/Content.Server/Body/Components/BloodstreamComponent.cs +++ b/Content.Server/Body/Components/BloodstreamComponent.cs @@ -72,7 +72,7 @@ namespace Content.Server.Body.Components /// How much reagent of blood should be restored each update interval? /// [DataField("bloodRefreshAmount")] - public float BloodRefreshAmount = 0.2f; + public float BloodRefreshAmount = 0.1f; /// /// How much blood needs to be in the temporary solution in order to create a puddle? diff --git a/Content.Server/Body/Systems/BloodstreamSystem.cs b/Content.Server/Body/Systems/BloodstreamSystem.cs index b17601a6f0..a54eb72af5 100644 --- a/Content.Server/Body/Systems/BloodstreamSystem.cs +++ b/Content.Server/Body/Systems/BloodstreamSystem.cs @@ -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()) + var query = new EntityQueryEnumerator(); + 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(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(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); }