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 0000000000..3fcb3c9e7f Binary files /dev/null and b/Resources/Audio/Effects/beep1.ogg differ diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index edd531cf15..e873e508e7 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -1232,6 +1232,8 @@ delay: 10 beepSound: path: /Audio/Weapons/Guns/MagOut/pistol_magout.ogg #funny sfx use + params: + volume: -2 beepInterval: 1 - type: Explosive explosionType: Default diff --git a/Resources/Prototypes/Entities/Objects/Devices/Electronics/triggers.yml b/Resources/Prototypes/Entities/Objects/Devices/Electronics/triggers.yml index aa4ae65c3b..a2738e8be5 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Electronics/triggers.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Electronics/triggers.yml @@ -25,6 +25,8 @@ delayOptions: [3, 5, 10, 15, 30] initialBeepDelay: 0 beepSound: /Audio/Machines/Nuke/general_beep.ogg + params: + volume: -2 - type: StaticPrice price: 40 diff --git a/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml b/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml index edd208b232..a72e512c9d 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml @@ -178,6 +178,8 @@ delay: 7 initialBeepDelay: 0 beepSound: /Audio/Machines/Nuke/general_beep.ogg + params: + volume: -2 - type: ExplodeOnTrigger - type: GibOnTrigger deleteItems: true diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/funny.yml b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/funny.yml index c7c7f272fc..f7b4d4c5ac 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/funny.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/funny.yml @@ -18,6 +18,8 @@ - type: OnUseTimerTrigger delay: 180 beepSound: /Audio/Machines/Nuke/general_beep.ogg + params: + volume: -2 - type: ExplodeOnTrigger - type: Explosive explosionType: Default diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml b/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml index fe469e79c3..4d8235ccba 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml @@ -45,6 +45,13 @@ intensitySlope: 3 totalIntensity: 120 # about a ~4 tile radius canCreateVacuum: false + - type: OnUseTimerTrigger + beepSound: + path: "/Audio/Effects/beep1.ogg" + params: + volume: 5 + initialBeepDelay: 0 + beepInterval: 2 # 2 beeps total (at 0 and 2) - type: entity name: flashbang