]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Cleanup: Use ``SoundSpecifier`` instead of string literals in ``VomitSystem`` (#35426)
authorWinkarst <74284083+Winkarst-cpu@users.noreply.github.com>
Sun, 23 Feb 2025 21:53:04 +0000 (00:53 +0300)
committerGitHub <noreply@github.com>
Sun, 23 Feb 2025 21:53:04 +0000 (22:53 +0100)
* Cleanup

* Update

* Update

Content.Server/Medical/VomitSystem.cs
Resources/Prototypes/SoundCollections/disease.yml

index 5cff161e0ebdaad02bddf4f43bd1f6c79412ec33..a6982cea4f763712489eda9399ae7679775c23b3 100644 (file)
@@ -31,6 +31,12 @@ namespace Content.Server.Medical
         [Dependency] private readonly ForensicsSystem _forensics = default!;
         [Dependency] private readonly BloodstreamSystem _bloodstream = default!;
 
+        [ValidatePrototypeId<SoundCollectionPrototype>]
+        private const string VomitCollection = "Vomit";
+
+        private readonly SoundSpecifier _vomitSound = new SoundCollectionSpecifier(VomitCollection,
+            AudioParams.Default.WithVariation(0.2f).WithVolume(-4f));
+
         /// <summary>
         /// Make an entity vomit, if they have a stomach.
         /// </summary>
@@ -94,7 +100,7 @@ namespace Content.Server.Medical
             }
 
             // Force sound to play as spill doesn't work if solution is empty.
-            _audio.PlayPvs("/Audio/Effects/Fluids/splat.ogg", uid, AudioParams.Default.WithVariation(0.2f).WithVolume(-4f));
+            _audio.PlayPvs(_vomitSound, uid);
             _popup.PopupEntity(Loc.GetString("disease-vomit", ("person", Identity.Entity(uid, EntityManager))), uid);
         }
     }
index f7489450081a5bf5ef5a1130ceb578a304ee9674..9e052998b34faf90bdec8bc77b85a4706875fd22 100644 (file)
@@ -62,3 +62,8 @@
   id: Honks
   files:
   - /Audio/Items/bikehorn.ogg
+
+- type: soundCollection
+  id: Vomit
+  files:
+  - /Audio/Effects/Fluids/splat.ogg