ExplosiveComponent.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using Content.Shared.Explosion.EntitySystems;
  2. using Robust.Shared.Prototypes;
  3. namespace Content.Shared.Explosion.Components;
  4. /// <summary>
  5. /// Specifies an explosion that can be spawned by this entity. The explosion itself is spawned via <see
  6. /// cref="ExplosionSystem.TriggerExplosive"/>.
  7. /// </summary>
  8. /// <remarks>
  9. /// The total intensity may be overridden by whatever system actually calls TriggerExplosive(), but this
  10. /// component still determines the explosion type and other properties.
  11. /// </remarks>
  12. [RegisterComponent, Access(typeof(SharedExplosionSystem))]
  13. public sealed partial class ExplosiveComponent : Component
  14. {
  15. /// <summary>
  16. /// The explosion prototype. This determines the damage types, the tile-break chance, and some visual
  17. /// information (e.g., the light that the explosion gives off).
  18. /// </summary>
  19. [DataField(required: true)]
  20. public ProtoId<ExplosionPrototype> ExplosionType = default!;
  21. /// <summary>
  22. /// The maximum intensity the explosion can have on a single tile. This limits the maximum damage and tile
  23. /// break chance the explosion can achieve at any given location.
  24. /// </summary>
  25. [DataField]
  26. public float MaxIntensity = 4;
  27. /// <summary>
  28. /// How quickly the intensity drops off as you move away from the epicenter.
  29. /// </summary>
  30. [DataField]
  31. public float IntensitySlope = 1;
  32. /// <summary>
  33. /// The total intensity of this explosion. The radius of the explosion scales like the cube root of this
  34. /// number (see <see cref="ExplosionSystem.RadiusToIntensity"/>).
  35. /// </summary>
  36. /// <remarks>
  37. /// This number can be overridden by passing optional argument to <see
  38. /// cref="ExplosionSystem.TriggerExplosive"/>.
  39. /// </remarks>
  40. [DataField]
  41. public float TotalIntensity = 10;
  42. /// <summary>
  43. /// Factor used to scale the explosion intensity when calculating tile break chances. Allows for stronger
  44. /// explosives that don't space tiles, without having to create a new explosion-type prototype.
  45. /// </summary>
  46. [DataField]
  47. public float TileBreakScale = 1f;
  48. /// <summary>
  49. /// Maximum number of times that an explosive can break a tile. Currently, for normal space stations breaking a
  50. /// tile twice will generally result in a vacuum.
  51. /// </summary>
  52. [DataField]
  53. public int MaxTileBreak = int.MaxValue;
  54. /// <summary>
  55. /// Whether this explosive should be able to create a vacuum by breaking tiles.
  56. /// </summary>
  57. [DataField]
  58. public bool CanCreateVacuum = true;
  59. /// <summary>
  60. /// An override for whether or not the entity should be deleted after it explodes.
  61. /// If null, the system calling the explode method handles it.
  62. /// </summary>
  63. [DataField]
  64. public bool? DeleteAfterExplosion;
  65. /// <summary>
  66. /// Whether to not set <see cref="Exploded"/> to true, allowing it to explode multiple times.
  67. /// This should never be used if it is damageable.
  68. /// </summary>
  69. [DataField]
  70. public bool Repeatable;
  71. /// <summary>
  72. /// Avoid somehow double-triggering this explosion (e.g. by damaging this entity from its own explosion.
  73. /// </summary>
  74. public bool Exploded;
  75. }