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);
|
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))
|
if (!Resolve(gatheredUid, ref component))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (TryComp<SoundOnGatherComponent>(gatheredUid, out var soundComp))
|
||||||
|
{
|
||||||
|
_audio.PlayPvs(soundComp.Sound, Transform(gatheredUid).Coordinates);
|
||||||
|
}
|
||||||
|
|
||||||
// Complete the gathering process
|
// Complete the gathering process
|
||||||
_destructible.DestroyEntity(gatheredUid);
|
_destructible.DestroyEntity(gatheredUid);
|
||||||
_audio.PlayPvs(sound, gatheredUid);
|
|
||||||
|
|
||||||
// Spawn the loot!
|
// Spawn the loot!
|
||||||
if (component.MappedLoot == null)
|
if (component.MappedLoot == null)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Server.Shuttles.Components;
|
using Content.Server.Shuttles.Components;
|
||||||
|
using Content.Shared.Audio;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics.Dynamics;
|
using Robust.Shared.Physics.Dynamics;
|
||||||
@@ -51,7 +52,7 @@ public sealed partial class ShuttleSystem
|
|||||||
|
|
||||||
var coordinates = new EntityCoordinates(ourXform.MapUid.Value, args.WorldPoint);
|
var coordinates = new EntityCoordinates(ourXform.MapUid.Value, args.WorldPoint);
|
||||||
var volume = MathF.Min(10f, 1f * MathF.Pow(jungleDiff, 0.5f) - 5f);
|
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);
|
_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.Popups;
|
||||||
using Content.Server.Storage.Components;
|
using Content.Server.Storage.Components;
|
||||||
using Content.Server.Storage.EntitySystems;
|
using Content.Server.Storage.EntitySystems;
|
||||||
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
using Content.Shared.Body.Part;
|
using Content.Shared.Body.Part;
|
||||||
using Content.Shared.Buckle.Components;
|
using Content.Shared.Buckle.Components;
|
||||||
@@ -158,7 +159,7 @@ namespace Content.Server.Toilet
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
component.IsSeatUp = !component.IsSeatUp;
|
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);
|
UpdateSprite(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ public abstract class SharedContentAudioSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Standard variation to use for sounds.
|
||||||
|
/// </summary>
|
||||||
|
public const float DefaultVariation = 0.05f;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
@@ -23,18 +24,18 @@ public sealed class AbsorbentComponent : Component
|
|||||||
[DataField("pickupSound")]
|
[DataField("pickupSound")]
|
||||||
public SoundSpecifier PickupSound = new SoundPathSpecifier("/Audio/Effects/Fluids/watersplash.ogg")
|
public SoundSpecifier PickupSound = new SoundPathSpecifier("/Audio/Effects/Fluids/watersplash.ogg")
|
||||||
{
|
{
|
||||||
Params = AudioParams.Default.WithVariation(0.05f),
|
Params = AudioParams.Default.WithVariation(SharedContentAudioSystem.DefaultVariation),
|
||||||
};
|
};
|
||||||
|
|
||||||
[DataField("transferSound")] public SoundSpecifier TransferSound =
|
[DataField("transferSound")] public SoundSpecifier TransferSound =
|
||||||
new SoundPathSpecifier("/Audio/Effects/Fluids/slosh.ogg")
|
new SoundPathSpecifier("/Audio/Effects/Fluids/slosh.ogg")
|
||||||
{
|
{
|
||||||
Params = AudioParams.Default.WithVariation(0.05f).WithVolume(-3f),
|
Params = AudioParams.Default.WithVariation(SharedContentAudioSystem.DefaultVariation).WithVolume(-3f),
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly SoundSpecifier DefaultTransferSound =
|
public static readonly SoundSpecifier DefaultTransferSound =
|
||||||
new SoundPathSpecifier("/Audio/Effects/Fluids/slosh.ogg")
|
new SoundPathSpecifier("/Audio/Effects/Fluids/slosh.ogg")
|
||||||
{
|
{
|
||||||
Params = AudioParams.Default.WithVariation(0.05f).WithVolume(-3f),
|
Params = AudioParams.Default.WithVariation(SharedContentAudioSystem.DefaultVariation).WithVolume(-3f),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.CombatMode;
|
using Content.Shared.CombatMode;
|
||||||
using Content.Shared.Containers.ItemSlots;
|
using Content.Shared.Containers.ItemSlots;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
@@ -403,7 +404,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
if (playSound && TryComp<CartridgeAmmoComponent>(entity, out var cartridge))
|
if (playSound && TryComp<CartridgeAmmoComponent>(entity, out var cartridge))
|
||||||
{
|
{
|
||||||
Audio.PlayPvs(cartridge.EjectSound, entity, AudioParams.Default.WithVariation(0.05f).WithVolume(-1f));
|
Audio.PlayPvs(cartridge.EjectSound, entity, AudioParams.Default.WithVariation(SharedContentAudioSystem.DefaultVariation).WithVolume(-1f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,3 +52,8 @@
|
|||||||
license: "CC0-1.0"
|
license: "CC0-1.0"
|
||||||
copyright: "Taken from MATRIXXX_ via freesound.org and mixed from stereo to mono."
|
copyright: "Taken from MATRIXXX_ via freesound.org and mixed from stereo to mono."
|
||||||
source: "https://freesound.org/people/MATRIXXX_/sounds/415990/"
|
source: "https://freesound.org/people/MATRIXXX_/sounds/415990/"
|
||||||
|
|
||||||
|
- files: ["break_stone.ogg"]
|
||||||
|
license: "CC-BY-SA-3.0"
|
||||||
|
copyright: "Taken from tgstation"
|
||||||
|
source: "https://github.com/tgstation/tgstation/blob/e3a835b96043fad1269ee7b0c3a6cb340a466f3a/sound/effects/break_stone.ogg"
|
||||||
BIN
Resources/Audio/Effects/break_stone.ogg
Normal file
BIN
Resources/Audio/Effects/break_stone.ogg
Normal file
Binary file not shown.
@@ -7,6 +7,7 @@
|
|||||||
suffix: Low Ore Yield
|
suffix: Low Ore Yield
|
||||||
description: A rocky asteroid.
|
description: A rocky asteroid.
|
||||||
components:
|
components:
|
||||||
|
- type: SoundOnGather
|
||||||
- type: Gatherable
|
- type: Gatherable
|
||||||
whitelist:
|
whitelist:
|
||||||
tags:
|
tags:
|
||||||
@@ -63,10 +64,6 @@
|
|||||||
suffix: higher ore yield
|
suffix: higher ore yield
|
||||||
description: An asteroid.
|
description: An asteroid.
|
||||||
components:
|
components:
|
||||||
- type: Gatherable
|
|
||||||
whitelist:
|
|
||||||
tags:
|
|
||||||
- Pickaxe
|
|
||||||
- type: OreVein
|
- type: OreVein
|
||||||
oreChance: 0.33
|
oreChance: 0.33
|
||||||
oreRarityPrototypeId: RandomOreDistributionStandard
|
oreRarityPrototypeId: RandomOreDistributionStandard
|
||||||
@@ -103,10 +100,6 @@
|
|||||||
suffix: higher ore yield
|
suffix: higher ore yield
|
||||||
description: An asteroid.
|
description: An asteroid.
|
||||||
components:
|
components:
|
||||||
- type: Gatherable
|
|
||||||
whitelist:
|
|
||||||
tags:
|
|
||||||
- Pickaxe
|
|
||||||
- type: OreVein
|
- type: OreVein
|
||||||
oreChance: 0.33
|
oreChance: 0.33
|
||||||
oreRarityPrototypeId: RandomOreDistributionStandard
|
oreRarityPrototypeId: RandomOreDistributionStandard
|
||||||
@@ -118,6 +111,7 @@
|
|||||||
parent: BaseStructure
|
parent: BaseStructure
|
||||||
name: rock
|
name: rock
|
||||||
components:
|
components:
|
||||||
|
- type: SoundOnGather
|
||||||
- type: Gatherable
|
- type: Gatherable
|
||||||
whitelist:
|
whitelist:
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
Reference in New Issue
Block a user