replacing sound (collection) names with SoundSpecifier - part 1
This commit is contained in:
@@ -9,6 +9,7 @@ using Content.Shared.Body.Slot;
|
||||
using Content.Shared.MobState;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -16,6 +17,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Body
|
||||
{
|
||||
@@ -26,6 +28,8 @@ namespace Content.Server.Body
|
||||
{
|
||||
private Container _partContainer = default!;
|
||||
|
||||
[DataField("gibSound")] private SoundSpecifier _gibSound = new SoundCollectionSpecifier("gib");
|
||||
|
||||
protected override bool CanAddPart(string slotId, SharedBodyPartComponent part)
|
||||
{
|
||||
return base.CanAddPart(slotId, part) &&
|
||||
@@ -101,8 +105,8 @@ namespace Content.Server.Body
|
||||
{
|
||||
base.Gib(gibParts);
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(Owner), AudioHelpers.GetRandomFileFromSoundCollection("gib"), Owner.Transform.Coordinates,
|
||||
AudioHelpers.WithVariation(0.025f));
|
||||
if(_gibSound.TryGetSound(out var sound))
|
||||
SoundSystem.Play(Filter.Pvs(Owner), sound, Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.025f));
|
||||
|
||||
if (Owner.TryGetComponent(out ContainerManagerComponent? container))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user