LightningTargetComponent.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using Content.Server.Tesla.EntitySystems;
  2. using Content.Shared.Explosion;
  3. using Content.Shared.FixedPoint;
  4. using Robust.Shared.Prototypes;
  5. namespace Content.Server.Lightning.Components;
  6. /// <summary>
  7. /// This component allows the lightning system to select a given entity as the target of a lightning strike.
  8. /// It also determines the priority of selecting this target, and the behavior of the explosion. Used for tesla.
  9. /// </summary>
  10. [RegisterComponent, Access(typeof(LightningSystem), typeof(LightningTargetSystem))]
  11. public sealed partial class LightningTargetComponent : Component
  12. {
  13. /// <summary>
  14. /// The probability that this target will not be ignored by a lightning strike. This is necessary for Tesla's balance.
  15. /// </summary>
  16. [DataField, ViewVariables(VVAccess.ReadWrite)]
  17. public float HitProbability = 1f;
  18. /// <summary>
  19. /// Priority level for selecting a lightning target.
  20. /// </summary>
  21. [DataField, ViewVariables(VVAccess.ReadWrite)]
  22. public int Priority;
  23. /// <summary>
  24. /// Lightning has a number of bounces into neighboring targets.
  25. /// This number controls how many bounces the lightning bolt has left after hitting that target.
  26. /// At high values, the lightning will not travel farther than that entity.
  27. /// </summary>
  28. [DataField, ViewVariables(VVAccess.ReadWrite)]
  29. public int LightningResistance = 1; //by default, reduces the number of bounces from this target by 1
  30. // BOOM PART
  31. /// <summary>
  32. /// Will the entity explode after being struck by lightning?
  33. /// </summary>
  34. [DataField, ViewVariables(VVAccess.ReadWrite)]
  35. public bool LightningExplode = true;
  36. /// <summary>
  37. /// The explosion prototype to spawn
  38. /// </summary>
  39. [DataField, ViewVariables(VVAccess.ReadWrite)]
  40. public ProtoId<ExplosionPrototype> ExplosionPrototype = "Default";
  41. /// <summary>
  42. /// The total amount of intensity an explosion can achieve
  43. /// </summary>
  44. [DataField, ViewVariables(VVAccess.ReadWrite)]
  45. public float TotalIntensity = 25f;
  46. /// <summary>
  47. /// How quickly does the explosion's power slope? Higher = smaller area and more concentrated damage, lower = larger area and more spread out damage
  48. /// </summary>
  49. [DataField, ViewVariables(VVAccess.ReadWrite)]
  50. public float Dropoff = 2f;
  51. /// <summary>
  52. /// How much intensity can be applied per tile?
  53. /// </summary>
  54. [DataField, ViewVariables(VVAccess.ReadWrite)]
  55. public float MaxTileIntensity = 5f;
  56. /// <summary>
  57. /// how much structural damage the object takes from a lightning strike
  58. /// </summary>
  59. [DataField]
  60. public FixedPoint2 DamageFromLightning = 1;
  61. }