]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Cleanup: Use ``SoundCollectionSpecifier`` instead of string literals in ``BibleSystem...
authorWinkarst <74284083+Winkarst-cpu@users.noreply.github.com>
Mon, 24 Feb 2025 21:23:50 +0000 (00:23 +0300)
committerGitHub <noreply@github.com>
Mon, 24 Feb 2025 21:23:50 +0000 (08:23 +1100)
* Cleanup

* Update

Content.Server/Bible/BibleSystem.cs
Content.Server/Bible/Components/BibleComponent.cs
Content.Server/Bible/Components/SummonableComponent.cs
Resources/Prototypes/SoundCollections/bible.yml [new file with mode: 0644]

index 76efe3290bf0c03fd18f07d7ba3722ee376c1f39..d9033a0f9426fcd5ad2fa3b29518105354ebb08e 100644 (file)
@@ -84,7 +84,7 @@ namespace Content.Server.Bible
                 }
                 summonableComp.AlreadySummoned = false;
                 _popupSystem.PopupEntity(Loc.GetString("bible-summon-respawn-ready", ("book", uid)), uid, PopupType.Medium);
-                _audio.PlayPvs("/Audio/Effects/radpulse9.ogg", uid, AudioParams.Default.WithVolume(-4f));
+                _audio.PlayPvs(summonableComp.SummonSound, uid);
                 // Clean up the accumulator and respawn tracking component
                 summonableComp.Accumulator = 0;
                 _remQueue.Enqueue(uid);
@@ -126,7 +126,7 @@ namespace Content.Server.Bible
                     var selfFailMessage = Loc.GetString(component.LocPrefix + "-heal-fail-self", ("target", Identity.Entity(args.Target.Value, EntityManager)), ("bible", uid));
                     _popupSystem.PopupEntity(selfFailMessage, args.User, args.User, PopupType.MediumCaution);
 
-                    _audio.PlayPvs("/Audio/Effects/hit_kick.ogg", args.User);
+                    _audio.PlayPvs(component.BibleHitSound, args.User);
                     _damageableSystem.TryChangeDamage(args.Target.Value, component.DamageOnFail, true, origin: uid);
                     _delay.TryResetDelay((uid, useDelay));
                     return;
index b7dc3db8e35d87af0912463a51b13ba18a6da1ae..7f4af569e5f46883de2dd51575c9adcf523731fa 100644 (file)
@@ -1,11 +1,23 @@
 using Content.Shared.Damage;
 using Robust.Shared.Audio;
+using Robust.Shared.Prototypes;
 
 namespace Content.Server.Bible.Components
 {
     [RegisterComponent]
     public sealed partial class BibleComponent : Component
     {
+        /// <summary>
+        /// Default sound when bible hits somebody.
+        /// </summary>
+        private static readonly ProtoId<SoundCollectionPrototype> DefaultBibleHit = new("BibleHit");
+
+        /// <summary>
+        /// Sound to play when bible hits somebody.
+        /// </summary>
+        [DataField]
+        public SoundSpecifier BibleHitSound = new SoundCollectionSpecifier(DefaultBibleHit, AudioParams.Default.WithVolume(-4f));
+
         /// <summary>
         /// Damage that will be healed on a success
         /// </summary>
index 62f536d5d6999d7a2dc7d9f3446a19118b46f7bd..fa180c932eb77383184f82cc319b55714cb073b2 100644 (file)
@@ -1,3 +1,4 @@
+using Robust.Shared.Audio;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
 
@@ -9,6 +10,17 @@ namespace Content.Server.Bible.Components
     [RegisterComponent]
     public sealed partial class SummonableComponent : Component
     {
+        /// <summary>
+        /// Default sound to play when entity is summoned.
+        /// </summary>
+        private static readonly ProtoId<SoundCollectionPrototype> DefaultSummonSound = new("Summon");
+
+        /// <summary>
+        /// Sound to play when entity is summoned.
+        /// </summary>
+        [DataField]
+        public SoundSpecifier SummonSound = new SoundCollectionSpecifier(DefaultSummonSound, AudioParams.Default.WithVolume(-4f));
+
         /// <summary>
         /// Used for a special item only the Chaplain can summon. Usually a mob, but supports regular items too.
         /// </summary>
diff --git a/Resources/Prototypes/SoundCollections/bible.yml b/Resources/Prototypes/SoundCollections/bible.yml
new file mode 100644 (file)
index 0000000..9007588
--- /dev/null
@@ -0,0 +1,9 @@
+- type: soundCollection
+  id: Summon
+  files:
+  - /Audio/Effects/radpulse9.ogg
+
+- type: soundCollection
+  id: BibleHit
+  files:
+  - /Audio/Effects/hit_kick.ogg