RadiationCollectorComponent.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using Content.Server.Singularity.EntitySystems;
  2. using Content.Shared.Atmos;
  3. namespace Content.Server.Singularity.Components;
  4. /// <summary>
  5. /// Generates electricity from radiation.
  6. /// </summary>
  7. [RegisterComponent]
  8. [Access(typeof(RadiationCollectorSystem))]
  9. public sealed partial class RadiationCollectorComponent : Component
  10. {
  11. /// <summary>
  12. /// Power output (in Watts) per unit of radiation collected.
  13. /// </summary>
  14. [DataField]
  15. [ViewVariables(VVAccess.ReadWrite)]
  16. public float ChargeModifier = 30000f;
  17. /// <summary>
  18. /// Number of power ticks that the power supply can remain active for. This is needed since
  19. /// power and radiation don't update at the same tickrate, and since radiation does not provide
  20. /// an update when radiation is removed. When this goes to zero, zero out the power supplier
  21. /// to model the radiation source going away.
  22. /// </summary>
  23. [DataField]
  24. [ViewVariables(VVAccess.ReadWrite)]
  25. public int PowerTicksLeft = 0;
  26. /// <summary>
  27. /// Is the machine enabled.
  28. /// </summary>
  29. [DataField]
  30. [ViewVariables]
  31. public bool Enabled;
  32. /// <summary>
  33. /// List of gases that will react to the radiation passing through the collector
  34. /// </summary>
  35. [DataField]
  36. [ViewVariables(VVAccess.ReadWrite)]
  37. public List<RadiationReactiveGas>? RadiationReactiveGases;
  38. }
  39. /// <summary>
  40. /// Describes how a gas reacts to the collected radiation
  41. /// </summary>
  42. [DataDefinition]
  43. public sealed partial class RadiationReactiveGas
  44. {
  45. /// <summary>
  46. /// The reactant gas
  47. /// </summary>
  48. [DataField(required: true)]
  49. public Gas ReactantPrototype;
  50. /// <summary>
  51. /// Multipier for the amount of power produced by the radiation collector when using this gas
  52. /// </summary>
  53. [DataField]
  54. public float PowerGenerationEfficiency = 1f;
  55. /// <summary>
  56. /// Controls the rate (molar percentage per rad) at which the reactant breaks down when exposed to radiation
  57. /// </summary>
  58. /// /// <remarks>
  59. /// Set to zero if the reactant does not deplete
  60. /// </remarks>
  61. [DataField]
  62. public float ReactantBreakdownRate = 1f;
  63. /// <summary>
  64. /// A byproduct gas that is generated when the reactant breaks down
  65. /// </summary>
  66. /// <remarks>
  67. /// Leave null if the reactant no byproduct gas is to be formed
  68. /// </remarks>
  69. [DataField]
  70. public Gas? Byproduct;
  71. /// <summary>
  72. /// The molar ratio of the byproduct gas generated from the reactant gas
  73. /// </summary>
  74. [DataField]
  75. public float MolarRatio = 1f;
  76. }