EmitSound prediction (#13282)
This commit is contained in:
17
Content.Shared/Sound/Components/BaseEmitSoundComponent.cs
Normal file
17
Content.Shared/Sound/Components/BaseEmitSoundComponent.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Shared.Sound.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Base sound emitter which defines most of the data fields.
|
||||
/// Accepts both single sounds and sound collections.
|
||||
/// </summary>
|
||||
public abstract class BaseEmitSoundComponent : Component
|
||||
{
|
||||
public static readonly AudioParams DefaultParams = AudioParams.Default.WithVolume(-2f);
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("sound", required: true)]
|
||||
public SoundSpecifier? Sound;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Sound.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple sound emitter that emits sound on ActivateInWorld
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class EmitSoundOnActivateComponent : BaseEmitSoundComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether or not to mark an interaction as handled after playing the sound. Useful if this component is
|
||||
/// used to play sound for some other component with activation functionality.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If false, you should be confident that the interaction will also be handled by some other system, as
|
||||
/// otherwise this might enable sound spamming, as use-delays are only initiated if the interaction was
|
||||
/// handled.
|
||||
/// </remarks>
|
||||
[DataField("handle")]
|
||||
public bool Handle = true;
|
||||
}
|
||||
}
|
||||
12
Content.Shared/Sound/Components/EmitSoundOnDropComponent.cs
Normal file
12
Content.Shared/Sound/Components/EmitSoundOnDropComponent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Sound.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple sound emitter that emits sound on entity drop
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class EmitSoundOnDropComponent : BaseEmitSoundComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
12
Content.Shared/Sound/Components/EmitSoundOnLandComponent.cs
Normal file
12
Content.Shared/Sound/Components/EmitSoundOnLandComponent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Sound.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple sound emitter that emits sound on LandEvent
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class EmitSoundOnLandComponent : BaseEmitSoundComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Sound.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple sound emitter that emits sound on entity pickup
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class EmitSoundOnPickupComponent : BaseEmitSoundComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
11
Content.Shared/Sound/Components/EmitSoundOnSpawnComponent.cs
Normal file
11
Content.Shared/Sound/Components/EmitSoundOnSpawnComponent.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Sound.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Simple sound emitter that emits sound on entity spawn.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class EmitSoundOnSpawnComponent : BaseEmitSoundComponent
|
||||
{
|
||||
}
|
||||
12
Content.Shared/Sound/Components/EmitSoundOnThrowComponent.cs
Normal file
12
Content.Shared/Sound/Components/EmitSoundOnThrowComponent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Sound.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple sound emitter that emits sound on ThrowEvent
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class EmitSoundOnThrowComponent : BaseEmitSoundComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
23
Content.Shared/Sound/Components/EmitSoundOnUseComponent.cs
Normal file
23
Content.Shared/Sound/Components/EmitSoundOnUseComponent.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Sound.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple sound emitter that emits sound on UseInHand
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class EmitSoundOnUseComponent : BaseEmitSoundComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether or not to mark an interaction as handled after playing the sound. Useful if this component is
|
||||
/// used to play sound for some other component with on-use functionality
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If false, you should be confident that the interaction will also be handled by some other system, as
|
||||
/// otherwise this might enable sound spamming, as use-delays are only initiated if the interaction was
|
||||
/// handled.
|
||||
/// </remarks>
|
||||
[DataField("handle")]
|
||||
public bool Handle = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user