]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Move guardian sounds to component (#36870)
authorTayrtahn <tayrtahn@gmail.com>
Wed, 23 Apr 2025 23:29:49 +0000 (19:29 -0400)
committerGitHub <noreply@github.com>
Wed, 23 Apr 2025 23:29:49 +0000 (01:29 +0200)
Content.Server/Guardian/GuardianComponent.cs
Content.Server/Guardian/GuardianSystem.cs

index a54d03375679efd4d29c0e6e4564da7d537845f9..7a010c6a0b30e84d7cc6154c9197b0a28eea99ae 100644 (file)
@@ -1,3 +1,5 @@
+using Robust.Shared.Audio;
+
 namespace Content.Server.Guardian
 {
     /// <summary>
@@ -30,5 +32,23 @@ namespace Content.Server.Guardian
         [DataField]
         public bool GuardianLoose;
 
+        /// <summary>
+        /// Sound played when a mob starts hosting the guardian.
+        /// </summary>
+        [DataField]
+        public SoundSpecifier InjectSound = new SoundPathSpecifier("/Audio/Effects/guardian_inject.ogg");
+
+        /// <summary>
+        /// Sound played when the guardian enters critical state.
+        /// </summary>
+        [DataField]
+        public SoundSpecifier CriticalSound = new SoundPathSpecifier("/Audio/Effects/guardian_warn.ogg");
+
+        /// <summary>
+        /// Sound played when the guardian dies.
+        /// </summary>
+        [DataField]
+        public SoundSpecifier DeathSound = new SoundPathSpecifier("/Audio/Voice/Human/malescream_guardian.ogg", AudioParams.Default.WithVariation(0.2f));
+
     }
 }
index e8c3fe7028f0d9e6158522f7bd05aa06596a3008..9c482586281f7d5ec7fc2eb9bc9d74153b2c3a68 100644 (file)
@@ -1,7 +1,6 @@
 using Content.Server.Body.Systems;
 using Content.Server.Popups;
 using Content.Shared.Actions;
-using Content.Shared.Audio;
 using Content.Shared.Damage;
 using Content.Shared.DoAfter;
 using Content.Shared.Examine;
@@ -13,8 +12,6 @@ using Content.Shared.Interaction;
 using Content.Shared.Interaction.Events;
 using Content.Shared.Mobs;
 using Content.Shared.Popups;
-using Robust.Server.GameObjects;
-using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Containers;
 using Robust.Shared.Player;
@@ -224,7 +221,7 @@ namespace Content.Server.Guardian
             if (TryComp<GuardianComponent>(guardian, out var guardianComp))
             {
                 guardianComp.Host = args.Args.Target.Value;
-                _audio.PlayPvs("/Audio/Effects/guardian_inject.ogg", args.Args.Target.Value);
+                _audio.PlayPvs(guardianComp.InjectSound, args.Args.Target.Value);
                 _popupSystem.PopupEntity(Loc.GetString("guardian-created"), args.Args.Target.Value, args.Args.Target.Value);
                 // Exhaust the activator
                 component.Used = true;
@@ -246,15 +243,18 @@ namespace Content.Server.Guardian
             if (component.HostedGuardian == null)
                 return;
 
+            TryComp<GuardianComponent>(component.HostedGuardian, out var guardianComp);
+
             if (args.NewMobState == MobState.Critical)
             {
                 _popupSystem.PopupEntity(Loc.GetString("guardian-host-critical-warn"), component.HostedGuardian.Value, component.HostedGuardian.Value);
-                _audio.PlayPvs("/Audio/Effects/guardian_warn.ogg", component.HostedGuardian.Value);
+                if (guardianComp != null)
+                    _audio.PlayPvs(guardianComp.CriticalSound, component.HostedGuardian.Value);
             }
             else if (args.NewMobState == MobState.Dead)
             {
-                //TODO: Replace WithVariation with datafield
-                _audio.PlayPvs("/Audio/Voice/Human/malescream_guardian.ogg", uid, AudioParams.Default.WithVariation(0.20f));
+                if (guardianComp != null)
+                    _audio.PlayPvs(guardianComp.DeathSound, uid);
                 RemComp<GuardianHostComponent>(uid);
             }
         }