From 25e5930c075306d14998db47b8f1d75f1f677a0c Mon Sep 17 00:00:00 2001 From: Slava0135 <40753025+Slava0135@users.noreply.github.com> Date: Tue, 2 May 2023 18:13:39 +0300 Subject: [PATCH] Explosive grenade sound (#15582) --- .../Components/ActiveTimerTriggerComponent.cs | 3 --- .../Components/OnUseTimerTriggerComponent.cs | 3 --- .../EntitySystems/TriggerSystem.Mobstate.cs | 3 +-- .../EntitySystems/TriggerSystem.OnUse.cs | 6 ++---- .../Explosion/EntitySystems/TriggerSystem.cs | 14 +++++++------- .../Nutrition/EntitySystems/CreamPieSystem.cs | 3 +-- Resources/Audio/Effects/attributions.yml | 5 +++++ Resources/Audio/Effects/beep1.ogg | Bin 0 -> 6244 bytes .../Prototypes/Entities/Mobs/NPCs/animals.yml | 2 ++ .../Objects/Devices/Electronics/triggers.yml | 2 ++ .../Entities/Objects/Misc/subdermal_implants.yml | 2 ++ .../Entities/Objects/Weapons/Bombs/funny.yml | 2 ++ .../Objects/Weapons/Throwable/grenades.yml | 7 +++++++ 13 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 Resources/Audio/Effects/beep1.ogg diff --git a/Content.Server/Explosion/Components/ActiveTimerTriggerComponent.cs b/Content.Server/Explosion/Components/ActiveTimerTriggerComponent.cs index 3edd308d4f..69115f3130 100644 --- a/Content.Server/Explosion/Components/ActiveTimerTriggerComponent.cs +++ b/Content.Server/Explosion/Components/ActiveTimerTriggerComponent.cs @@ -22,7 +22,4 @@ public sealed class ActiveTimerTriggerComponent : Component [DataField("beepSound")] public SoundSpecifier? BeepSound; - - [DataField("beepParams")] - public AudioParams BeepParams = AudioParams.Default; } diff --git a/Content.Server/Explosion/Components/OnUseTimerTriggerComponent.cs b/Content.Server/Explosion/Components/OnUseTimerTriggerComponent.cs index 54969c7752..f4941350dd 100644 --- a/Content.Server/Explosion/Components/OnUseTimerTriggerComponent.cs +++ b/Content.Server/Explosion/Components/OnUseTimerTriggerComponent.cs @@ -29,9 +29,6 @@ namespace Content.Server.Explosion.Components [DataField("beepInterval")] public float BeepInterval = 1; - [DataField("beepParams")] - public AudioParams BeepParams = AudioParams.Default.WithVolume(-2f); - /// /// Should timer be started when it was stuck to another entity. /// Used for C4 charges and similar behaviour. diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.Mobstate.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.Mobstate.cs index 793cac830f..701bdf44ff 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.Mobstate.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.Mobstate.cs @@ -28,8 +28,7 @@ public sealed partial class TriggerSystem timerTrigger.Delay, timerTrigger.BeepInterval, timerTrigger.InitialBeepDelay, - timerTrigger.BeepSound, - timerTrigger.BeepParams); + timerTrigger.BeepSound); } else diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.OnUse.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.OnUse.cs index 826ed29e12..b2ef93b74d 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.OnUse.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.OnUse.cs @@ -31,8 +31,7 @@ public sealed partial class TriggerSystem component.Delay, component.BeepInterval, component.InitialBeepDelay, - component.BeepSound, - component.BeepParams); + component.BeepSound); } private void OnExamined(EntityUid uid, OnUseTimerTriggerComponent component, ExaminedEvent args) @@ -150,8 +149,7 @@ public sealed partial class TriggerSystem component.Delay, component.BeepInterval, component.InitialBeepDelay, - component.BeepSound, - component.BeepParams); + component.BeepSound); args.Handled = true; } diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs index 4fbd646585..f61cbee54c 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs @@ -52,6 +52,7 @@ namespace Content.Server.Explosion.EntitySystems [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly BodySystem _body = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; public override void Initialize() { @@ -155,7 +156,7 @@ namespace Content.Server.Explosion.EntitySystems return triggerEvent.Handled; } - public void HandleTimerTrigger(EntityUid uid, EntityUid? user, float delay , float beepInterval, float? initialBeepDelay, SoundSpecifier? beepSound, AudioParams beepParams) + public void HandleTimerTrigger(EntityUid uid, EntityUid? user, float delay , float beepInterval, float? initialBeepDelay, SoundSpecifier? beepSound) { if (delay <= 0) { @@ -198,7 +199,6 @@ namespace Content.Server.Explosion.EntitySystems var active = AddComp(uid); active.TimeRemaining = delay; active.User = user; - active.BeepParams = beepParams; active.BeepSound = beepSound; active.BeepInterval = beepInterval; active.TimeUntilBeep = initialBeepDelay == null ? active.BeepInterval : initialBeepDelay.Value; @@ -222,15 +222,16 @@ namespace Content.Server.Explosion.EntitySystems private void UpdateTimer(float frameTime) { HashSet toRemove = new(); - foreach (var timer in EntityQuery()) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var timer)) { timer.TimeRemaining -= frameTime; timer.TimeUntilBeep -= frameTime; if (timer.TimeRemaining <= 0) { - Trigger(timer.Owner, timer.User); - toRemove.Add(timer.Owner); + Trigger(uid, timer.User); + toRemove.Add(uid); continue; } @@ -238,8 +239,7 @@ namespace Content.Server.Explosion.EntitySystems continue; timer.TimeUntilBeep += timer.BeepInterval; - var filter = Filter.Pvs(timer.Owner, entityManager: EntityManager); - SoundSystem.Play(timer.BeepSound.GetSound(), filter, timer.Owner, timer.BeepParams); + _audio.PlayPvs(timer.BeepSound, uid, timer.BeepSound.Params); } foreach (var uid in toRemove) diff --git a/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs b/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs index 1f1164f3d4..a20bce96ff 100644 --- a/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs @@ -74,8 +74,7 @@ namespace Content.Server.Nutrition.EntitySystems timerTrigger.Delay, timerTrigger.BeepInterval, timerTrigger.InitialBeepDelay, - timerTrigger.BeepSound, - timerTrigger.BeepParams); + timerTrigger.BeepSound); } } } diff --git a/Resources/Audio/Effects/attributions.yml b/Resources/Audio/Effects/attributions.yml index 263b872aee..9cccf2651f 100644 --- a/Resources/Audio/Effects/attributions.yml +++ b/Resources/Audio/Effects/attributions.yml @@ -27,3 +27,8 @@ license: "CC0-1.0" copyright: "Taken from felix.blume via freesound.org and cropped + mixed from stereo to mono." source: "https://freesound.org/people/felix.blume/sounds/414093/" + +- files: ["beep1.ogg"] + license: "CC0-1.0" + copyright: "Taken from thisusernameis via freesound.org + mixed from stereo to mono." + source: "https://freesound.org/people/thisusernameis/sounds/426891/" \ No newline at end of file diff --git a/Resources/Audio/Effects/beep1.ogg b/Resources/Audio/Effects/beep1.ogg new file mode 100644 index 0000000000000000000000000000000000000000..3fcb3c9e7f812f015d56a5a14ac1fe6140bdb9cf GIT binary patch literal 6244 zcmahtdpuOz_j|@`NDPLgsVJ{0Vi;wF#+yMg8n3x?iN>Qb$Qb38662ACG>9l{H0 zRHUxgElFgMXDO84FK$%7J>z!2-|t_){n_W7b=Gt5wb$BvowFl2*aINJKh5UK+1o;J z#f1+Jh&70qh^T;2wh)1^trk82h&M%up4SmOgp&U@p`?&<9n&-{XZiEL+7YoOHL{TE zvMVNNv*9M=O?X2?A@>@1F~S2Qb~B>CYMFm2E6s!FhZkiQJgR5oX zot>y-0ijeP#DxlRXzO1$J7Nf=TA@~RCk;(y6JMClW4U%jZ#2ZssB`75uNNd%6Ctyv ziKAPhByk4Iy{o62me6W=U4<)dqMM%Z+_3X;;xg;hfwp4;&lx7zEy=9cLNc%ma9(KtqigNC@$4aE7g@jt6i1>odBRo?wF3f*uPF- z|Ej|-LoN4_fU5vdkk2u#%rWD+W45MGww9<*9lfA;|FWnXiNqZNaC4Wn+l!GB$?XOJ zRcxBZ_fF%7q)n%0pt#A^NDvQzI5b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