]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Give BaseItem a landing sound (#14504)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sat, 11 Mar 2023 08:26:01 +0000 (19:26 +1100)
committerGitHub <noreply@github.com>
Sat, 11 Mar 2023 08:26:01 +0000 (19:26 +1100)
Content.Shared/Sound/SharedEmitSoundSystem.cs
Content.Shared/Throwing/ThrowingSystem.cs
Content.Shared/Throwing/ThrownItemSystem.cs
Resources/Audio/Effects/attributions.yml
Resources/Audio/Effects/drop.ogg [new file with mode: 0644]
Resources/Audio/Effects/licenses.txt
Resources/Prototypes/Entities/Objects/base_item.yml

index c50951f73ebaa77666e7264ae6db913903ee396d..c7bf5cf137c16a346fc492311895f2c5f89d8e96 100644 (file)
@@ -98,12 +98,12 @@ namespace Content.Shared.Sound
 
             if (predict)
             {
-                _audioSystem.PlayPredicted(component.Sound, component.Owner, user, component.Sound.Params.AddVolume(-2f));
+                _audioSystem.PlayPredicted(component.Sound, component.Owner, user);
             }
             else if (_netMan.IsServer)
             {
                 // don't predict sounds that client couldn't have played already
-                _audioSystem.PlayPvs(component.Sound, component.Owner, component.Sound.Params.AddVolume(-2f));
+                _audioSystem.PlayPvs(component.Sound, component.Owner);
             }
         }
     }
index 331c98feebfd6f7db945ead3b7b7800437973df3..1b7cfd7d6f0c6ef7f7c5e314c56da5a10f5be260 100644 (file)
@@ -82,7 +82,7 @@ public sealed class ThrowingSystem : EntitySystem
 
         if (time < FlyTime)
         {
-            _thrownSystem.LandComponent(comp, physics);
+            _thrownSystem.LandComponent(uid, comp, physics);
         }
         else
         {
@@ -93,7 +93,7 @@ public sealed class ThrowingSystem : EntitySystem
                 if (physics.Deleted)
                     return;
 
-                _thrownSystem.LandComponent(comp, physics);
+                _thrownSystem.LandComponent(uid, comp, physics);
             });
         }
 
@@ -104,7 +104,7 @@ public sealed class ThrowingSystem : EntitySystem
             _gravity.IsWeightless(user.Value, userPhysics))
         {
             var msg = new ThrowPushbackAttemptEvent();
-            RaiseLocalEvent(physics.Owner, msg);
+            RaiseLocalEvent(uid, msg);
 
             if (!msg.Cancelled)
                 _physics.ApplyLinearImpulse(user.Value, -impulseVector * pushbackRatio, body: userPhysics);
index e497b2ec19beea79973da35834155e1cec553fdb..d2b4d2dd467c6e5f59adcc1aac8cc90151f36602 100644 (file)
@@ -8,6 +8,7 @@ using Robust.Shared.GameStates;
 using Robust.Shared.Physics;
 using Robust.Shared.Physics.Dynamics;
 using System.Linq;
+using Content.Shared.Sound.Components;
 using Robust.Shared.Physics.Components;
 using Robust.Shared.Physics.Events;
 using Robust.Shared.Physics.Systems;
@@ -117,16 +118,17 @@ namespace Content.Shared.Throwing
             EntityManager.RemoveComponent<ThrownItemComponent>(uid);
         }
 
-        public void LandComponent(ThrownItemComponent thrownItem, PhysicsComponent physics)
+        public void LandComponent(EntityUid uid, ThrownItemComponent thrownItem, PhysicsComponent physics)
         {
             _physics.SetBodyStatus(physics, BodyStatus.OnGround);
 
-            if (thrownItem.Deleted || Deleted(thrownItem.Owner) || _containerSystem.IsEntityInContainer(thrownItem.Owner)) return;
+            if (thrownItem.Deleted || Deleted(uid) || _containerSystem.IsEntityInContainer(uid))
+                return;
 
-            var landing = thrownItem.Owner;
+            var landing = uid;
 
             // Unfortunately we can't check for hands containers as they have specific names.
-            if (thrownItem.Owner.TryGetContainerMan(out var containerManager) &&
+            if (uid.TryGetContainerMan(out var containerManager) &&
                 EntityManager.HasComponent<SharedHandsComponent>(containerManager.Owner))
             {
                 EntityManager.RemoveComponent(landing, thrownItem);
index 66b0c39ac942d379a6b68f9e3611e49b4b987d65..1c7843072020acae78a45aa26b09084743bb1c06 100644 (file)
@@ -2,7 +2,23 @@
   license: "CC-BY-NC-SA-3.0"
   copyright: "Amateur foley and audio editing by Bright0."
   source: "https://github.com/Bright0"
+
 - files: ["teleport_arrival.ogg", "teleport_departure.ogg"]
   license: "CC-BY-SA-3.0"
   copyright: "tgstation"
   source: "https://github.com/tgstation/tgstation/commit/906fb0682bab6a0975b45036001c54f021f58ae7"
+
+- files: ["sadtrombone.ogg"]
+  license: "CC-BY-NC-SA-3.0"
+  copyright: "sadtrombone.ogg taken from Citadel Station."
+  source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/35a1723e98a60f375df590ca572cc90f1bb80bd5"
+
+- files: ["box_deploy.ogg"]
+  license: "CC-BY-NC-SA-3.0"
+  copyright: "box_deploy.ogg taken from Citadel Station."
+  source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/b604390f334343be80045d955705cf48ee056c61"
+
+- files: ["chime.ogg"]
+  license: "CC-BY-NC-SA-3.0"
+  copyright: "chime.ogg taken from Citadel Station."
+  source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/b604390f334343be80045d955705cf48ee056c61"
diff --git a/Resources/Audio/Effects/drop.ogg b/Resources/Audio/Effects/drop.ogg
new file mode 100644 (file)
index 0000000..3f1d45c
Binary files /dev/null and b/Resources/Audio/Effects/drop.ogg differ
index 93e28159278f078b895fbe627d4a8a533b2372ca..95d0d98f7092c795af7a2013a419308769a888c5 100644 (file)
@@ -32,11 +32,6 @@ bite.ogg take from https://github.com/tgstation/tgstation/commit/d4f678a1772007f
 
 bone_rattle.ogg licensed under CC0 1.0 and taken from spookymodem at https://freesound.org/people/spookymodem/sounds/202102/
 
-- files: ["sadtrombone.ogg"]
-  license: "CC-BY-NC-SA-3.0"
-  copyright: "sadtrombone.ogg taken from Citadel Station."
-  source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/35a1723e98a60f375df590ca572cc90f1bb80bd5"
-
 The following sounds are taken from TGstation github (licensed under CC by 3.0):
 
     demon_attack1.ogg: taken at https://github.com/tgstation/tgstation/commit/d4f678a1772007ff8d7eddd21cf7218c8e07bfc0
@@ -49,12 +44,10 @@ pop.ogg licensed under CC0 1.0 by mirrorcult
 
 box_deploy.ogg and chime.ogg taken from Citadel Station at commit: https://github.com/Citadel-Station-13/Citadel-Station-13/commit/b604390f334343be80045d955705cf48ee056c61
 
-- files: ["box_deploy.ogg"]
-  license: "CC-BY-NC-SA-3.0"
-  copyright: "box_deploy.ogg taken from Citadel Station."
-  source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/b604390f334343be80045d955705cf48ee056c61"
 
-- files: ["chime.ogg"]
-  license: "CC-BY-NC-SA-3.0"
-  copyright: "chime.ogg taken from Citadel Station."
-  source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/b604390f334343be80045d955705cf48ee056c61"
\ No newline at end of file
+ - files:
+     - "drop.ogg"
+   license: "Royalty free"
+   copyright: "Sonniss.com - GDC 2016 - Game Audio Bundle - Levan Nadashvili - Soldier Footsteps - FS Concrete Soldier Crouch N02, mixed from stereo to mono"
+
+# Do not add to this list, I only did the above because yaml scheme validator doesn't like custom licenses.
index 00d5171cfbda13ca0c74307e63d69d5f6a3e16ea..f9b171a7eb81be574d9d8ad2fb9241822f579ebc 100644 (file)
   - type: Clickable
   - type: InteractionOutline
   - type: MovedByPressure
+  - type: EmitSoundOnLand
+    sound:
+      path: /Audio/Effects/drop.ogg
+      params:
+        volume: 2
   - type: DamageOnHighSpeedImpact
     damage:
       types: