Stuttering during blood loss. (#15153)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -150,9 +150,9 @@ namespace Content.Server.Body.Components
|
|||||||
public Solution BloodTemporarySolution = default!;
|
public Solution BloodTemporarySolution = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Variable that stores the amount of drunk time added by having a low blood level.
|
/// Variable that stores the amount of status time added by having a low blood level.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public float DrunkTime;
|
public float StatusTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using Robust.Shared.Audio;
|
|||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
using Content.Shared.Speech.EntitySystems;
|
||||||
|
|
||||||
namespace Content.Server.Body.Systems;
|
namespace Content.Server.Body.Systems;
|
||||||
|
|
||||||
@@ -35,6 +36,7 @@ public sealed class BloodstreamSystem : EntitySystem
|
|||||||
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
|
||||||
[Dependency] private readonly SharedDrunkSystem _drunkSystem = default!;
|
[Dependency] private readonly SharedDrunkSystem _drunkSystem = default!;
|
||||||
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
|
||||||
|
[Dependency] private readonly SharedStutteringSystem _stutteringSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -117,21 +119,21 @@ public sealed class BloodstreamSystem : EntitySystem
|
|||||||
// The effect is applied in a way that it will never be cleared without being healthy.
|
// The effect is applied in a way that it will never be cleared without being healthy.
|
||||||
// Multiplying by 2 is arbitrary but works for this case, it just prevents the time from running out
|
// Multiplying by 2 is arbitrary but works for this case, it just prevents the time from running out
|
||||||
_drunkSystem.TryApplyDrunkenness(uid, bloodstream.UpdateInterval*2, false);
|
_drunkSystem.TryApplyDrunkenness(uid, bloodstream.UpdateInterval*2, false);
|
||||||
|
_stutteringSystem.DoStutter(uid, TimeSpan.FromSeconds(bloodstream.UpdateInterval*2), false);
|
||||||
|
|
||||||
// storing the drunk time so we can remove it independently from other effects additions
|
// storing the drunk and stutter time so we can remove it independently from other effects additions
|
||||||
bloodstream.DrunkTime += bloodstream.UpdateInterval * 2;
|
bloodstream.StatusTime += bloodstream.UpdateInterval * 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (_mobStateSystem.IsAlive(uid))
|
else if (_mobStateSystem.IsAlive(uid))
|
||||||
{
|
{
|
||||||
// If they're healthy, we'll try and heal some bloodloss instead.
|
// If they're healthy, we'll try and heal some bloodloss instead.
|
||||||
_damageableSystem.TryChangeDamage(uid, bloodstream.BloodlossHealDamage * bloodPercentage, true, false);
|
_damageableSystem.TryChangeDamage(uid, bloodstream.BloodlossHealDamage * bloodPercentage, true, false);
|
||||||
|
|
||||||
// Remove the drunk effect when healthy. Should only remove the amount of drunk added by low blood level
|
// Remove the drunk effect when healthy. Should only remove the amount of drunk and stutter added by low blood level
|
||||||
_drunkSystem.TryRemoveDrunkenessTime(uid, bloodstream.DrunkTime);
|
_drunkSystem.TryRemoveDrunkenessTime(uid, bloodstream.StatusTime);
|
||||||
// Reset the drunk time to zero
|
_stutteringSystem.DoRemoveStutterTime(uid, bloodstream.StatusTime);
|
||||||
bloodstream.DrunkTime = 0;
|
// Reset the drunk and stutter time to zero
|
||||||
|
bloodstream.StatusTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,25 @@
|
|||||||
using Content.Shared.StatusEffect;
|
using Content.Shared.StatusEffect;
|
||||||
|
|
||||||
namespace Content.Shared.Speech.EntitySystems
|
namespace Content.Shared.Speech.EntitySystems;
|
||||||
|
|
||||||
|
public abstract class SharedStutteringSystem : EntitySystem
|
||||||
{
|
{
|
||||||
public abstract class SharedStutteringSystem : EntitySystem
|
public const string StutterKey = "Stutter";
|
||||||
|
|
||||||
|
[Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
|
||||||
|
|
||||||
|
// For code in shared... I imagine we ain't getting accent prediction anytime soon so let's not bother.
|
||||||
|
public virtual void DoStutter(EntityUid uid, TimeSpan time, bool refresh, StatusEffectsComponent? status = null)
|
||||||
{
|
{
|
||||||
// For code in shared... I imagine we ain't getting accent prediction anytime soon so let's not bother.
|
}
|
||||||
public virtual void DoStutter(EntityUid uid, TimeSpan time, bool refresh, StatusEffectsComponent? status = null)
|
|
||||||
{
|
public virtual void DoRemoveStutterTime(EntityUid uid, double timeRemoved)
|
||||||
}
|
{
|
||||||
|
_statusEffectsSystem.TryRemoveTime(uid, StutterKey, TimeSpan.FromSeconds(timeRemoved));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoRemoveStutter(EntityUid uid, double timeRemoved)
|
||||||
|
{
|
||||||
|
_statusEffectsSystem.TryRemoveStatusEffect(uid, StutterKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user