GraveComponent.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using Content.Shared.DoAfter;
  2. using Robust.Shared.Audio;
  3. using Robust.Shared.GameStates;
  4. namespace Content.Shared.Burial.Components;
  5. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  6. public sealed partial class GraveComponent : Component
  7. {
  8. /// <summary>
  9. /// How long it takes to dig this grave, without modifiers
  10. /// </summary>
  11. [DataField, ViewVariables(VVAccess.ReadWrite)]
  12. public TimeSpan DigDelay = TimeSpan.FromSeconds(15);
  13. /// <summary>
  14. /// Modifier if digging yourself out by hand if buried alive
  15. /// TODO: Handle digging with bare hands in the tools system
  16. /// </summary>
  17. [DataField, ViewVariables(VVAccess.ReadWrite)]
  18. public float DigOutByHandModifier = 0.1f;
  19. /// <summary>
  20. /// Sound to make when digging/filling this grave
  21. /// </summary>
  22. [DataField, ViewVariables(VVAccess.ReadOnly)]
  23. public SoundPathSpecifier DigSound = new SoundPathSpecifier("/Audio/Items/shovel_dig.ogg")
  24. {
  25. Params = AudioParams.Default.WithLoop(true)
  26. };
  27. /// <summary>
  28. /// Is this grave in the process of being dug/filled?
  29. /// </summary>
  30. [DataField, ViewVariables(VVAccess.ReadOnly)]
  31. public bool DiggingComplete = false;
  32. [DataField, ViewVariables(VVAccess.ReadOnly)]
  33. public EntityUid? Stream;
  34. /// <summary>
  35. /// Auto-networked field to track shovel digging.
  36. /// This makes sure a looping audio Stream isn't opened
  37. /// on the client-side. (DoAfterId/EntityUid isn't serializable.)
  38. /// </summary>
  39. [DataField, ViewVariables(VVAccess.ReadOnly), AutoNetworkedField]
  40. public bool ActiveShovelDigging;
  41. /// <summary>
  42. /// Tracks someone digging themself out of the grave
  43. /// </summary>
  44. [DataField, ViewVariables(VVAccess.ReadOnly)]
  45. public DoAfterId? HandDiggingDoAfter;
  46. }