1
0

EventHorizonComponent.cs 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using Robust.Shared.GameStates;
  2. using Content.Shared.Singularity.EntitySystems;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  4. namespace Content.Shared.Singularity.Components;
  5. /// <summary>
  6. /// A component that makes the associated entity destroy other within some distance of itself.
  7. /// Also makes the associated entity destroy other entities upon contact.
  8. /// Primarily managed by <see cref="SharedEventHorizonSystem"/> and its server/client versions.
  9. /// </summary>
  10. [Access(friends: typeof(SharedEventHorizonSystem))]
  11. [RegisterComponent, NetworkedComponent, AutoGenerateComponentPause]
  12. public sealed partial class EventHorizonComponent : Component
  13. {
  14. /// <summary>
  15. /// The radius of the event horizon within which it will destroy all entities and tiles.
  16. /// If &lt; 0.0 this behavior will not be active.
  17. /// If you want to set this go through <see cref="SharedEventHorizonSystem.SetRadius"/>.
  18. /// </summary>
  19. [DataField("radius")]
  20. public float Radius;
  21. /// <summary>
  22. /// involves periodically destroying tiles within a specified radius
  23. /// </summary>
  24. [DataField]
  25. public bool ConsumeTiles = true;
  26. /// <summary>
  27. /// involves periodically destroying entities within a specified radius. Does not affect collide destruction of entities.
  28. /// </summary>
  29. [DataField]
  30. public bool ConsumeEntities = true;
  31. /// <summary>
  32. /// Whether the event horizon can consume/destroy the devices built to contain it.
  33. /// If you want to set this go through <see cref="SharedEventHorizonSystem.SetCanBreachContainment"/>.
  34. /// </summary>
  35. [DataField("canBreachContainment")]
  36. [ViewVariables(VVAccess.ReadWrite)]
  37. public bool CanBreachContainment = false;
  38. /// <summary>
  39. /// The ID of the fixture used to detect if the event horizon has collided with any physics objects.
  40. /// Can be set to null, in which case no such fixture is used.
  41. /// If you want to set this go through <see cref="SharedEventHorizonSystem.SetHorizonFixtureId"/>.
  42. /// </summary>
  43. [DataField("consumerFixtureId")]
  44. [ViewVariables(VVAccess.ReadWrite)]
  45. public string? ConsumerFixtureId = "EventHorizonConsumer";
  46. /// <summary>
  47. /// The ID of the fixture used to detect if the event horizon has collided with any physics objects.
  48. /// Can be set to null, in which case no such fixture is used.
  49. /// If you want to set this go through <see cref="SharedEventHorizonSystem.SetHorizonFixtureId"/>.
  50. /// </summary>
  51. [DataField("colliderFixtureId")]
  52. [ViewVariables(VVAccess.ReadWrite)]
  53. public string? ColliderFixtureId = "EventHorizonCollider";
  54. /// <summary>
  55. /// Whether the entity this event horizon is attached to is being consumed by another event horizon.
  56. /// </summary>
  57. [ViewVariables(VVAccess.ReadOnly)]
  58. public bool BeingConsumedByAnotherEventHorizon = false;
  59. #region Update Timing
  60. /// <summary>
  61. /// The amount of time that should elapse between this event horizon consuming everything it overlaps with.
  62. /// </summary>
  63. [DataField("consumePeriod")]
  64. [ViewVariables(VVAccess.ReadWrite)]
  65. public TimeSpan TargetConsumePeriod = TimeSpan.FromSeconds(0.5);
  66. /// <summary>
  67. /// The next time at which this consumed everything it overlapped with.
  68. /// </summary>
  69. [ViewVariables(VVAccess.ReadOnly), DataField("nextConsumeWaveTime", customTypeSerializer:typeof(TimeOffsetSerializer))]
  70. [AutoPausedField]
  71. public TimeSpan NextConsumeWaveTime;
  72. #endregion Update Timing
  73. }