SleepingComponent.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using Content.Shared.Dataset;
  2. using Content.Shared.FixedPoint;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Prototypes;
  6. namespace Content.Shared.Bed.Sleep;
  7. /// <summary>
  8. /// Added to entities when they go to sleep.
  9. /// </summary>
  10. [NetworkedComponent, RegisterComponent]
  11. [AutoGenerateComponentState, AutoGenerateComponentPause(Dirty = true)]
  12. public sealed partial class SleepingComponent : Component
  13. {
  14. /// <summary>
  15. /// How much damage of any type it takes to wake this entity.
  16. /// </summary>
  17. [DataField]
  18. public FixedPoint2 WakeThreshold = FixedPoint2.New(2);
  19. /// <summary>
  20. /// Cooldown time between users hand interaction.
  21. /// </summary>
  22. [DataField]
  23. public TimeSpan Cooldown = TimeSpan.FromSeconds(1f);
  24. [DataField]
  25. [AutoNetworkedField, AutoPausedField]
  26. public TimeSpan CooldownEnd;
  27. [DataField]
  28. [AutoNetworkedField]
  29. public EntityUid? WakeAction;
  30. /// <summary>
  31. /// Sound to play when another player attempts to wake this entity.
  32. /// </summary>
  33. [DataField]
  34. public SoundSpecifier WakeAttemptSound = new SoundPathSpecifier("/Audio/Effects/thudswoosh.ogg")
  35. {
  36. Params = AudioParams.Default.WithVariation(0.05f)
  37. };
  38. /// <summary>
  39. /// The fluent string prefix to use when picking a random suffix
  40. /// This is only active for those who have the sleeping component
  41. /// </summary>
  42. [DataField]
  43. public ProtoId<LocalizedDatasetPrototype> ForceSaySleepDataset = "ForceSaySleepDataset";
  44. }