diff --git a/Content.Server/Bed/Sleep/SleepingSystem.cs b/Content.Server/Bed/Sleep/SleepingSystem.cs index 1c9f60e124..ae6cd54140 100644 --- a/Content.Server/Bed/Sleep/SleepingSystem.cs +++ b/Content.Server/Bed/Sleep/SleepingSystem.cs @@ -57,7 +57,7 @@ namespace Content.Server.Bed.Sleep var emitSound = EnsureComp(uid); - // TODO WTF is this, these should a data fields and not hard-coded. + // TODO WTF is this, these should a data fields and not hard-coded. emitSound.Sound = new SoundCollectionSpecifier("Snores", AudioParams.Default.WithVariation(0.2f)); emitSound.PlayChance = 0.33f; emitSound.RollInterval = 5f; @@ -107,14 +107,14 @@ namespace Content.Server.Bed.Sleep /// private void OnMobStateChanged(EntityUid uid, SleepingComponent component, MobStateChangedEvent args) { - if (_mobStateSystem.IsCritical(uid) && !HasComp(uid)) + if (args.CurrentMobState == DamageState.Dead) { + RemComp(uid); RemComp(uid); return; } - - if (_mobStateSystem.IsDead(uid)) - RemComp(uid); + if (TryComp(uid, out var spam)) + spam.Enabled = (args.CurrentMobState == DamageState.Alive) ? true : false; } private void AddWakeVerb(EntityUid uid, SleepingComponent component, GetVerbsEvent args) diff --git a/Content.Server/Sound/Components/SpamEmitSoundComponent.cs b/Content.Server/Sound/Components/SpamEmitSoundComponent.cs index 3378421be9..3058a3c65c 100644 --- a/Content.Server/Sound/Components/SpamEmitSoundComponent.cs +++ b/Content.Server/Sound/Components/SpamEmitSoundComponent.cs @@ -18,5 +18,8 @@ namespace Content.Server.Sound.Components // Always Pvs. [DataField("popUp")] public string? PopUp; + + [DataField("enabled")] + public bool Enabled = true; } } diff --git a/Content.Server/Sound/EmitSoundSystem.cs b/Content.Server/Sound/EmitSoundSystem.cs index 58dd21186b..64a5c34535 100644 --- a/Content.Server/Sound/EmitSoundSystem.cs +++ b/Content.Server/Sound/EmitSoundSystem.cs @@ -36,6 +36,9 @@ namespace Content.Server.Sound base.Update(frameTime); foreach (var soundSpammer in EntityQuery()) { + if (!soundSpammer.Enabled) + continue; + soundSpammer.Accumulator += frameTime; if (soundSpammer.Accumulator < soundSpammer.RollInterval) {