Files
wwdpublic/Content.Shared/Clothing/Components/EmitsSoundOnMoveComponent.cs
VMSolidus 4cec892dd1 Hardsuit Walking Sounds And Refactor EmitSoundOnMove (#1698)
# Description

Thanks to MajorMoth for making these sound effects! This PR adds custom
sound effects to Hardsuits & Tacsuits that are generated when the wearer
moves. However while making this PR, I ran into three different bugs
with the EmitSoundOnMoveSystem, so I fixed all 3 of them!

# TODO

<details><summary><h1>Media</h1></summary>
<p>

https://github.com/user-attachments/assets/cb5d3873-3eb7-4cab-8ec2-2ba5b5d6480d

</p>
</details>

# Changelog

🆑 VMSolidus and MajorMoth
- add: Hardsuits now have sounds made when the wearer moves!
- fix: Fixed several bugs with EmitSoundOnMove. It no longer plays the
same sound 7 times in a row for the client. It can now differentiate
between items that must be worn to make sounds and otherwise. It can
also have variable distance needed to travel to make a sound.
- add: Hardsuits and Tacsuits are now separated into Light, Medium, and
Heavy categories, with each category having its own sound effects, mass,
throwing statistics, and don/doff time. Most hardsuits are Light. Most
Tacsuits are Medium. Some suits like Warden, Juggernaut, Nukie
Commander, and Mysta Bombsuit are heavy.

(cherry picked from commit cdf8468717bd14a1036148b491b8aeb0fd845ffa)
2025-02-05 18:16:43 +03:00

54 lines
1.6 KiB
C#

using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
namespace Content.Shared.Clothing.Components;
/// <summary>
/// Indicates that the clothing entity emits sound when it moves.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class EmitsSoundOnMoveComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField(required: true), AutoNetworkedField]
public SoundSpecifier SoundCollection = default!;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("requiresGravity"), AutoNetworkedField]
public bool RequiresGravity = true;
[ViewVariables(VVAccess.ReadOnly)]
public EntityCoordinates LastPosition = EntityCoordinates.Invalid;
/// <summary>
/// The distance moved since the played sound.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public float SoundDistance = 0f;
/// <summary>
/// Whether this item is equipped in a inventory item slot.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public bool IsSlotValid = true;
/// <summary>
/// If worn, how far the wearer has to walk in order to make a sound.
/// </summary>
[DataField]
public float DistanceWalking = 1.5f;
/// <summary>
/// If worn, how far the wearer has to sprint in order to make a sound.
/// </summary>
[DataField]
public float DistanceSprinting = 2f;
/// <summary>
/// Whether or not this item must be worn in order to make sounds.
/// </summary>
[DataField]
public bool RequiresWorn;
}