From 44106d5570cc4988e64e8e23de9f4bf02fe8c99d Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Wed, 23 Apr 2025 19:29:49 -0400 Subject: [PATCH] Move guardian sounds to component (#36870) --- Content.Server/Guardian/GuardianComponent.cs | 20 ++++++++++++++++++++ Content.Server/Guardian/GuardianSystem.cs | 14 +++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Content.Server/Guardian/GuardianComponent.cs b/Content.Server/Guardian/GuardianComponent.cs index a54d033756..7a010c6a0b 100644 --- a/Content.Server/Guardian/GuardianComponent.cs +++ b/Content.Server/Guardian/GuardianComponent.cs @@ -1,3 +1,5 @@ +using Robust.Shared.Audio; + namespace Content.Server.Guardian { /// @@ -30,5 +32,23 @@ namespace Content.Server.Guardian [DataField] public bool GuardianLoose; + /// + /// Sound played when a mob starts hosting the guardian. + /// + [DataField] + public SoundSpecifier InjectSound = new SoundPathSpecifier("/Audio/Effects/guardian_inject.ogg"); + + /// + /// Sound played when the guardian enters critical state. + /// + [DataField] + public SoundSpecifier CriticalSound = new SoundPathSpecifier("/Audio/Effects/guardian_warn.ogg"); + + /// + /// Sound played when the guardian dies. + /// + [DataField] + public SoundSpecifier DeathSound = new SoundPathSpecifier("/Audio/Voice/Human/malescream_guardian.ogg", AudioParams.Default.WithVariation(0.2f)); + } } diff --git a/Content.Server/Guardian/GuardianSystem.cs b/Content.Server/Guardian/GuardianSystem.cs index e8c3fe7028..9c48258628 100644 --- a/Content.Server/Guardian/GuardianSystem.cs +++ b/Content.Server/Guardian/GuardianSystem.cs @@ -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(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(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(uid); } }