CaptureAreaComponent.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. namespace Content.Server.GameTicking.Rules.Components;
  2. [RegisterComponent, Access(typeof(CaptureAreaSystem))]
  3. public sealed partial class CaptureAreaRuleComponent : Component
  4. {
  5. }
  6. [RegisterComponent]
  7. public sealed partial class CaptureAreaComponent : Component
  8. {
  9. /// <summary>
  10. /// The name for this capturable area
  11. /// </summary>
  12. [DataField("name")]
  13. public string Name { get; set; } = "Objective Area";
  14. /// <summary>
  15. /// How long does the area need to be held for, in seconds
  16. /// </summary>
  17. [DataField("captureDuration")]
  18. public float CaptureDuration { get; set; } = 300f;
  19. /// <summary>
  20. /// How far entities need to be to count towards capture
  21. /// </summary>
  22. [DataField("captureRadius")]
  23. public float CaptureRadius { get; set; } = 4f;
  24. /// <summary>
  25. /// What the capture timer is currently at
  26. /// </summary>
  27. [DataField("captureTimer")]
  28. public float CaptureTimer { get; set; } = 0f;
  29. /// <summary>
  30. /// Has 1 minute left been announced?
  31. /// </summary>
  32. [DataField("captureTimerAnnouncement1")]
  33. public bool CaptureTimerAnnouncement1 { get; set; } = false;
  34. /// <summary>
  35. /// Has 2 minute left been announced?
  36. /// </summary>
  37. [DataField("captureTimerAnnouncement2")]
  38. public bool CaptureTimerAnnouncement2 { get; set; } = false;
  39. /// <summary>
  40. /// Is the area currently occupied?
  41. /// </summary>
  42. [DataField("occupied")]
  43. public bool Occupied { get; set; } = false;
  44. /// <summary>
  45. /// Which faction is occupying the area?
  46. /// </summary>
  47. [DataField("controller")]
  48. public string Controller { get; set; } = "";
  49. /// <summary>
  50. /// The previous controller (for announcements when controller changes)
  51. /// </summary>
  52. [DataField("previousController")]
  53. public string PreviousController { get; set; } = "";
  54. /// <summary>
  55. /// Which factions can occupy this area?
  56. /// </summary>
  57. [DataField("capturableFactions")]
  58. public List<string> CapturableFactions { get; set; } = [];
  59. /// <summary>
  60. /// How long the area needs to be contested or lost before the capture timer resets
  61. /// </summary>
  62. [DataField("contestedResetTime")]
  63. public float ContestedResetTime { get; set; } = 10f;
  64. /// <summary>
  65. /// Current timer tracking how long the area has been contested or lost
  66. /// </summary>
  67. [DataField("contestedTimer")]
  68. public float ContestedTimer { get; set; } = 0f;
  69. /// <summary>
  70. /// The last controller before the area became contested or lost
  71. /// </summary>
  72. [DataField("lastController")]
  73. public string LastController { get; set; } = "";
  74. }