1
0

EmitSoundOnCollideComponent.cs 842 B

1234567891011121314151617181920212223
  1. using Robust.Shared.GameStates;
  2. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  3. namespace Content.Shared.Sound.Components;
  4. [RegisterComponent, NetworkedComponent, AutoGenerateComponentPause]
  5. public sealed partial class EmitSoundOnCollideComponent : BaseEmitSoundComponent
  6. {
  7. public static readonly TimeSpan CollideCooldown = TimeSpan.FromSeconds(0.2);
  8. /// <summary>
  9. /// Minimum velocity required for the sound to play.
  10. /// </summary>
  11. [ViewVariables(VVAccess.ReadWrite), DataField("minVelocity")]
  12. public float MinimumVelocity = 3f;
  13. /// <summary>
  14. /// To avoid sound spam add a cooldown to it.
  15. /// </summary>
  16. [ViewVariables(VVAccess.ReadWrite), DataField("nextSound", customTypeSerializer: typeof(TimeOffsetSerializer))]
  17. [AutoPausedField]
  18. public TimeSpan NextSound;
  19. }