Add gatherable break sounds (#19360)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using Content.Shared.Audio;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server.Gatherable.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Plays the specified sound when this entity is gathered.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(GatherableSystem))]
|
||||
public sealed class SoundOnGatherComponent : Component
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("sound")]
|
||||
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Effects/break_stone.ogg")
|
||||
{
|
||||
Params = AudioParams.Default
|
||||
.WithVariation(SharedContentAudioSystem.DefaultVariation)
|
||||
.WithVolume(-3f),
|
||||
};
|
||||
}
|
||||
@@ -43,14 +43,18 @@ public sealed partial class GatherableSystem : EntitySystem
|
||||
Gather(uid, args.User, component);
|
||||
}
|
||||
|
||||
public void Gather(EntityUid gatheredUid, EntityUid? gatherer = null, GatherableComponent? component = null, SoundSpecifier? sound = null)
|
||||
public void Gather(EntityUid gatheredUid, EntityUid? gatherer = null, GatherableComponent? component = null)
|
||||
{
|
||||
if (!Resolve(gatheredUid, ref component))
|
||||
return;
|
||||
|
||||
if (TryComp<SoundOnGatherComponent>(gatheredUid, out var soundComp))
|
||||
{
|
||||
_audio.PlayPvs(soundComp.Sound, Transform(gatheredUid).Coordinates);
|
||||
}
|
||||
|
||||
// Complete the gathering process
|
||||
_destructible.DestroyEntity(gatheredUid);
|
||||
_audio.PlayPvs(sound, gatheredUid);
|
||||
|
||||
// Spawn the loot!
|
||||
if (component.MappedLoot == null)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Shuttles.Components;
|
||||
using Content.Shared.Audio;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
@@ -51,7 +52,7 @@ public sealed partial class ShuttleSystem
|
||||
|
||||
var coordinates = new EntityCoordinates(ourXform.MapUid.Value, args.WorldPoint);
|
||||
var volume = MathF.Min(10f, 1f * MathF.Pow(jungleDiff, 0.5f) - 5f);
|
||||
var audioParams = AudioParams.Default.WithVariation(0.05f).WithVolume(volume);
|
||||
var audioParams = AudioParams.Default.WithVariation(SharedContentAudioSystem.DefaultVariation).WithVolume(volume);
|
||||
|
||||
_audio.Play(_shuttleImpactSound, Filter.Pvs(coordinates, rangeMultiplier: 4f, entityMan: EntityManager), coordinates, true, audioParams);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Shared.Buckle;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Server.Storage.EntitySystems;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.Buckle.Components;
|
||||
@@ -158,7 +159,7 @@ namespace Content.Server.Toilet
|
||||
return;
|
||||
|
||||
component.IsSeatUp = !component.IsSeatUp;
|
||||
_audio.PlayPvs(component.ToggleSound, uid, AudioParams.Default.WithVariation(0.05f));
|
||||
_audio.PlayPvs(component.ToggleSound, uid, AudioParams.Default.WithVariation(SharedContentAudioSystem.DefaultVariation));
|
||||
UpdateSprite(uid, component);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user