diff --git a/Content.Server/Body/Systems/BloodstreamSystem.cs b/Content.Server/Body/Systems/BloodstreamSystem.cs index 89e4dc8f59..12af8dc0ad 100644 --- a/Content.Server/Body/Systems/BloodstreamSystem.cs +++ b/Content.Server/Body/Systems/BloodstreamSystem.cs @@ -12,6 +12,7 @@ using Content.Shared.FixedPoint; using Content.Shared.IdentityManagement; using Content.Shared.MobState.Components; using Content.Shared.Popups; +using Content.Shared.Drunk; using Robust.Shared.Audio; using Robust.Shared.Player; using Robust.Shared.Prototypes; @@ -28,6 +29,8 @@ public sealed class BloodstreamSystem : EntitySystem [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = 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 @@ -108,6 +111,11 @@ public sealed class BloodstreamSystem : EntitySystem var amt = bloodstream.BloodlossDamage / (0.1f + bloodPercentage); _damageableSystem.TryChangeDamage(uid, amt, true, false); + + // Apply dizziness as a symptom of bloodloss. + // So, threshold is 0.9, you have 0.85 percent blood, it adds (5 * 1.05) or 5.25 seconds of drunkenness. + // So, it'd max at 1.9 by default with 0% blood. + _drunkSystem.TryApplyDrunkenness(uid, bloodstream.UpdateInterval * (1 + (bloodstream.BloodlossThreshold - bloodPercentage)), false); } else { diff --git a/Content.Server/Chemistry/ReagentEffects/Drunk.cs b/Content.Server/Chemistry/ReagentEffects/Drunk.cs index be98590eca..36702c42b9 100644 --- a/Content.Server/Chemistry/ReagentEffects/Drunk.cs +++ b/Content.Server/Chemistry/ReagentEffects/Drunk.cs @@ -11,9 +11,15 @@ public sealed class Drunk : ReagentEffect [DataField("boozePower")] public float BoozePower = 2f; + /// + /// Whether speech should be slurred. + /// + [DataField("slurSpeech")] + public bool SlurSpeech = true; + public override void Effect(ReagentEffectArgs args) { var drunkSys = args.EntityManager.EntitySysManager.GetEntitySystem(); - drunkSys.TryApplyDrunkenness(args.SolutionEntity, BoozePower); + drunkSys.TryApplyDrunkenness(args.SolutionEntity, BoozePower, SlurSpeech); } } diff --git a/Content.Shared/Drunk/DrunkSystem.cs b/Content.Shared/Drunk/DrunkSystem.cs index 57c3d8dcd5..ee9cc34fd0 100644 --- a/Content.Shared/Drunk/DrunkSystem.cs +++ b/Content.Shared/Drunk/DrunkSystem.cs @@ -10,13 +10,15 @@ public abstract class SharedDrunkSystem : EntitySystem [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; [Dependency] private readonly SharedSlurredSystem _slurredSystem = default!; - public void TryApplyDrunkenness(EntityUid uid, float boozePower, + public void TryApplyDrunkenness(EntityUid uid, float boozePower, bool applySlur = true, StatusEffectsComponent? status = null) { if (!Resolve(uid, ref status, false)) return; - _slurredSystem.DoSlur(uid, TimeSpan.FromSeconds(boozePower), status); + if (applySlur) + _slurredSystem.DoSlur(uid, TimeSpan.FromSeconds(boozePower), status); + if (!_statusEffectsSystem.HasStatusEffect(uid, DrunkKey, status)) { _statusEffectsSystem.TryAddStatusEffect(uid, DrunkKey, TimeSpan.FromSeconds(boozePower), true, status);