Move guardian sounds to component (#36870)
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
using Robust.Shared.Audio;
|
||||||
|
|
||||||
namespace Content.Server.Guardian
|
namespace Content.Server.Guardian
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,5 +32,23 @@ namespace Content.Server.Guardian
|
|||||||
[DataField]
|
[DataField]
|
||||||
public bool GuardianLoose;
|
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));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Content.Server.Body.Systems;
|
using Content.Server.Body.Systems;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using Content.Shared.Audio;
|
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Content.Shared.DoAfter;
|
using Content.Shared.DoAfter;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
@@ -13,8 +12,6 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.Audio;
|
|
||||||
using Robust.Shared.Audio.Systems;
|
using Robust.Shared.Audio.Systems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -224,7 +221,7 @@ namespace Content.Server.Guardian
|
|||||||
if (TryComp<GuardianComponent>(guardian, out var guardianComp))
|
if (TryComp<GuardianComponent>(guardian, out var guardianComp))
|
||||||
{
|
{
|
||||||
guardianComp.Host = args.Args.Target.Value;
|
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);
|
_popupSystem.PopupEntity(Loc.GetString("guardian-created"), args.Args.Target.Value, args.Args.Target.Value);
|
||||||
// Exhaust the activator
|
// Exhaust the activator
|
||||||
component.Used = true;
|
component.Used = true;
|
||||||
@@ -246,15 +243,18 @@ namespace Content.Server.Guardian
|
|||||||
if (component.HostedGuardian == null)
|
if (component.HostedGuardian == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
TryComp<GuardianComponent>(component.HostedGuardian, out var guardianComp);
|
||||||
|
|
||||||
if (args.NewMobState == MobState.Critical)
|
if (args.NewMobState == MobState.Critical)
|
||||||
{
|
{
|
||||||
_popupSystem.PopupEntity(Loc.GetString("guardian-host-critical-warn"), component.HostedGuardian.Value, component.HostedGuardian.Value);
|
_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)
|
else if (args.NewMobState == MobState.Dead)
|
||||||
{
|
{
|
||||||
//TODO: Replace WithVariation with datafield
|
if (guardianComp != null)
|
||||||
_audio.PlayPvs("/Audio/Voice/Human/malescream_guardian.ogg", uid, AudioParams.Default.WithVariation(0.20f));
|
_audio.PlayPvs(guardianComp.DeathSound, uid);
|
||||||
RemComp<GuardianHostComponent>(uid);
|
RemComp<GuardianHostComponent>(uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user