]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Explosive grenade sound (#15582)
authorSlava0135 <40753025+Slava0135@users.noreply.github.com>
Tue, 2 May 2023 15:13:39 +0000 (18:13 +0300)
committerGitHub <noreply@github.com>
Tue, 2 May 2023 15:13:39 +0000 (11:13 -0400)
13 files changed:
Content.Server/Explosion/Components/ActiveTimerTriggerComponent.cs
Content.Server/Explosion/Components/OnUseTimerTriggerComponent.cs
Content.Server/Explosion/EntitySystems/TriggerSystem.Mobstate.cs
Content.Server/Explosion/EntitySystems/TriggerSystem.OnUse.cs
Content.Server/Explosion/EntitySystems/TriggerSystem.cs
Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs
Resources/Audio/Effects/attributions.yml
Resources/Audio/Effects/beep1.ogg [new file with mode: 0644]
Resources/Prototypes/Entities/Mobs/NPCs/animals.yml
Resources/Prototypes/Entities/Objects/Devices/Electronics/triggers.yml
Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml
Resources/Prototypes/Entities/Objects/Weapons/Bombs/funny.yml
Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml

index 3edd308d4fe09a4f88b2f350daf4ae6fe68ac71d..69115f313011d8d8b11f56def60de5eeeffd9d8a 100644 (file)
@@ -22,7 +22,4 @@ public sealed class ActiveTimerTriggerComponent : Component
 
     [DataField("beepSound")]
     public SoundSpecifier? BeepSound;
-
-    [DataField("beepParams")]
-    public AudioParams BeepParams = AudioParams.Default;
 }
index 54969c7752796541b871e56d7ef08842aff7a72f..f4941350ddd4137b435fd2f1346dabf1d6e04c38 100644 (file)
@@ -29,9 +29,6 @@ namespace Content.Server.Explosion.Components
         [DataField("beepInterval")]
         public float BeepInterval = 1;
 
-        [DataField("beepParams")]
-        public AudioParams BeepParams = AudioParams.Default.WithVolume(-2f);
-
         /// <summary>
         ///     Should timer be started when it was stuck to another entity.
         ///     Used for C4 charges and similar behaviour.
index 793cac830f3260e73d4f8a078960eb5c9621d1ee..701bdf44ff08b2233a2c8fb364b1d3d4c1769005 100644 (file)
@@ -28,8 +28,7 @@ public sealed partial class TriggerSystem
                 timerTrigger.Delay,
                 timerTrigger.BeepInterval,
                 timerTrigger.InitialBeepDelay,
-                timerTrigger.BeepSound,
-                timerTrigger.BeepParams);
+                timerTrigger.BeepSound);
         }
 
         else
index 826ed29e12c3936bec7b00c2fce39262ced1829d..b2ef93b74d40622e25c0dcc07474d7bcd0bf2bb4 100644 (file)
@@ -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;
     }
index 4fbd6465851892b29515097b0103b4ac12da7239..f61cbee54c441a0da7075a22c3b404e3775f44cb 100644 (file)
@@ -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<ActiveTimerTriggerComponent>(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<EntityUid> toRemove = new();
-            foreach (var timer in EntityQuery<ActiveTimerTriggerComponent>())
+            var query = EntityQueryEnumerator<ActiveTimerTriggerComponent>();
+            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)
index 1f1164f3d444ee37612f1f4af806e3ed1fd5ff75..a20bce96ff20c3e8c7f08d7f5f2df6791f6e31b3 100644 (file)
@@ -74,8 +74,7 @@ namespace Content.Server.Nutrition.EntitySystems
                             timerTrigger.Delay,
                             timerTrigger.BeepInterval,
                             timerTrigger.InitialBeepDelay,
-                            timerTrigger.BeepSound,
-                            timerTrigger.BeepParams);
+                            timerTrigger.BeepSound);
                     }
                 }
             }
index 263b872aeed9bce847fbdf6d49cb8d126083bdf6..9cccf2651fad6bf0be312bf6cb0fbe0017b236d7 100644 (file)
@@ -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 (file)
index 0000000..3fcb3c9
Binary files /dev/null and b/Resources/Audio/Effects/beep1.ogg differ
index edd531cf159d290a276cdeb94d6d98f3f7c44383..e873e508e73520fcf1ab09c10b99bc932a69b18c 100644 (file)
     delay: 10
     beepSound:
       path: /Audio/Weapons/Guns/MagOut/pistol_magout.ogg #funny sfx use
+      params:
+        volume: -2
     beepInterval: 1
   - type: Explosive
     explosionType: Default
index aa4ae65c3b7a219cbd4ab03a3db5e2773bae817d..a2738e8be50b66affa1722e0e4d7a2d4224d427c 100644 (file)
@@ -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
 
index edd208b2329600d187328e3a97c497063880376d..a72e512c9df63c0a1558dacb1a5439b4163e87d9 100644 (file)
       delay: 7
       initialBeepDelay: 0
       beepSound: /Audio/Machines/Nuke/general_beep.ogg
+      params:
+        volume: -2
     - type: ExplodeOnTrigger
     - type: GibOnTrigger
       deleteItems: true
index c7c7f272fc416b64a0a1fc1d8a591e09488ec958..f7b4d4c5acb069d51104f88cbf07d9f9ac93e675 100644 (file)
@@ -18,6 +18,8 @@
     - type: OnUseTimerTrigger
       delay: 180
       beepSound: /Audio/Machines/Nuke/general_beep.ogg
+      params:
+        volume: -2
     - type: ExplodeOnTrigger
     - type: Explosive
       explosionType: Default
index fe469e79c3dcec7ebc3029a8ae0927783d5eb113..4d8235ccba2c9044c8138b14617a4c3c9852844c 100644 (file)
     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