Blood tweaks & fixes (#14648)
This commit is contained in:
@@ -72,7 +72,7 @@ namespace Content.Server.Body.Components
|
|||||||
/// How much reagent of blood should be restored each update interval?
|
/// How much reagent of blood should be restored each update interval?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("bloodRefreshAmount")]
|
[DataField("bloodRefreshAmount")]
|
||||||
public float BloodRefreshAmount = 0.2f;
|
public float BloodRefreshAmount = 0.1f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How much blood needs to be in the temporary solution in order to create a puddle?
|
/// How much blood needs to be in the temporary solution in order to create a puddle?
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using Content.Shared.Drunk;
|
|||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Content.Shared.Rejuvenate;
|
using Content.Shared.Rejuvenate;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
@@ -31,13 +32,9 @@ public sealed class BloodstreamSystem : EntitySystem
|
|||||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
[Dependency] private readonly AudioSystem _audio = default!;
|
||||||
[Dependency] private readonly SharedDrunkSystem _drunkSystem = 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()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -82,7 +79,8 @@ public sealed class BloodstreamSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
base.Update(frameTime);
|
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;
|
bloodstream.AccumulatedFrametime += frameTime;
|
||||||
|
|
||||||
@@ -91,7 +89,6 @@ public sealed class BloodstreamSystem : EntitySystem
|
|||||||
|
|
||||||
bloodstream.AccumulatedFrametime -= bloodstream.UpdateInterval;
|
bloodstream.AccumulatedFrametime -= bloodstream.UpdateInterval;
|
||||||
|
|
||||||
var uid = bloodstream.Owner;
|
|
||||||
if (TryComp<MobStateComponent>(uid, out var state) && _mobStateSystem.IsDead(uid, state))
|
if (TryComp<MobStateComponent>(uid, out var state) && _mobStateSystem.IsDead(uid, state))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -103,7 +100,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
|||||||
// as well as stop their bleeding to a certain extent.
|
// as well as stop their bleeding to a certain extent.
|
||||||
if (bloodstream.BleedAmount > 0)
|
if (bloodstream.BleedAmount > 0)
|
||||||
{
|
{
|
||||||
TryModifyBloodLevel(uid, (-bloodstream.BleedAmount) / 20, bloodstream);
|
TryModifyBloodLevel(uid, (-bloodstream.BleedAmount) / 10, bloodstream);
|
||||||
TryModifyBleedAmount(uid, -bloodstream.BleedReductionAmount, bloodstream);
|
TryModifyBleedAmount(uid, -bloodstream.BleedReductionAmount, bloodstream);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,6 +146,10 @@ public sealed class BloodstreamSystem : EntitySystem
|
|||||||
if (args.DamageDelta is null)
|
if (args.DamageDelta is null)
|
||||||
return;
|
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
|
// TODO probably cache this or something. humans get hurt a lot
|
||||||
if (!_prototypeManager.TryIndex<DamageModifierSetPrototype>(component.DamageBleedModifiers, out var modifiers))
|
if (!_prototypeManager.TryIndex<DamageModifierSetPrototype>(component.DamageBleedModifiers, out var modifiers))
|
||||||
return;
|
return;
|
||||||
@@ -168,7 +169,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
|||||||
if (totalFloat > 0 && _robustRandom.Prob(prob))
|
if (totalFloat > 0 && _robustRandom.Prob(prob))
|
||||||
{
|
{
|
||||||
TryModifyBloodLevel(uid, (-total) / 5, component);
|
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))
|
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.
|
// because it's burn damage that cauterized their wounds.
|
||||||
|
|
||||||
// We'll play a special sound and popup for feedback.
|
// 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,
|
_popupSystem.PopupEntity(Loc.GetString("bloodstream-component-wounds-cauterized"), uid,
|
||||||
uid, PopupType.Medium);
|
uid, PopupType.Medium);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user