replacing sound (collection) names with SoundSpecifier - part 1

This commit is contained in:
Galactic Chimp
2021-07-10 17:35:33 +02:00
parent 4500b66f28
commit ce3c59e0e6
131 changed files with 934 additions and 587 deletions

View File

@@ -1,4 +1,5 @@
#nullable enable
using Content.Shared.Sound;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
@@ -31,5 +32,14 @@ namespace Content.Server.Stunnable.Components
[ViewVariables(VVAccess.ReadWrite)]
[DataField("energyPerUse")]
public float EnergyPerUse { get; set; } = 50;
[DataField("stunSound")]
public SoundSpecifier StunSound { get; set; } = new SoundPathSpecifier("/Audio/Weapons/egloves.ogg");
[DataField("sparksSound")]
public SoundSpecifier SparksSound { get; set; } = new SoundCollectionSpecifier("sparks");
[DataField("turnOnFailSound")]
public SoundSpecifier TurnOnFailSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/button.ogg");
}
}

View File

@@ -4,6 +4,7 @@ using Content.Server.Notification;
using Content.Shared.Audio;
using Content.Shared.MobState;
using Content.Shared.Notification.Managers;
using Content.Shared.Sound;
using Content.Shared.Standing;
using Content.Shared.Stunnable;
using Robust.Shared.Audio;
@@ -12,6 +13,7 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Stunnable.Components
{
@@ -19,6 +21,8 @@ namespace Content.Server.Stunnable.Components
[ComponentReference(typeof(SharedStunnableComponent))]
public class StunnableComponent : SharedStunnableComponent, IDisarmedAct
{
[DataField("stunAttemptSound")] private SoundSpecifier _stunAttemptSound = new SoundPathSpecifier("/Audio/Effects/thudswoosh.ogg");
protected override void OnKnockdown()
{
EntitySystem.Get<StandingStateSystem>().Down(Owner);
@@ -54,7 +58,8 @@ namespace Content.Server.Stunnable.Components
protected override void OnInteractHand()
{
SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/thudswoosh.ogg", Owner, AudioHelpers.WithVariation(0.05f));
if(_stunAttemptSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner, AudioHelpers.WithVariation(0.05f));
}
bool IDisarmedAct.Disarmed(DisarmedActEventArgs eventArgs)
@@ -69,8 +74,8 @@ namespace Content.Server.Stunnable.Components
if (source != null)
{
SoundSystem.Play(Filter.Pvs(source), "/Audio/Effects/thudswoosh.ogg", source,
AudioHelpers.WithVariation(0.025f));
if (_stunAttemptSound.TryGetSound(out var sound))
SoundSystem.Play(Filter.Pvs(source), sound, source, AudioHelpers.WithVariation(0.025f));
if (target != null)
{
source.PopupMessageOtherClients(Loc.GetString("stunnable-component-disarm-success-others", ("source", source.Name),("target", target.Name)));