FuelGeneratorComponent.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using Content.Shared.Guidebook;
  2. using Robust.Shared.GameStates;
  3. namespace Content.Shared.Power.Generator;
  4. /// <summary>
  5. /// This is used for generators that run off some kind of fuel.
  6. /// </summary>
  7. /// <remarks>
  8. /// <para>
  9. /// Generators must be anchored to be able to run.
  10. /// </para>
  11. /// </remarks>
  12. /// <seealso cref="SharedGeneratorSystem"/>
  13. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedGeneratorSystem))]
  14. public sealed partial class FuelGeneratorComponent : Component
  15. {
  16. /// <summary>
  17. /// Is the generator currently running?
  18. /// </summary>
  19. [DataField, AutoNetworkedField]
  20. public bool On;
  21. /// <summary>
  22. /// The generator's target power.
  23. /// </summary>
  24. [DataField]
  25. public float TargetPower = 15_000.0f;
  26. /// <summary>
  27. /// The maximum target power.
  28. /// </summary>
  29. [DataField]
  30. [GuidebookData]
  31. public float MaxTargetPower = 30_000.0f;
  32. /// <summary>
  33. /// The minimum target power.
  34. /// </summary>
  35. /// <remarks>
  36. /// Setting this to any value above 0 means that the generator can't idle without consuming some amount of fuel.
  37. /// </remarks>
  38. [DataField]
  39. public float MinTargetPower = 1_000;
  40. /// <summary>
  41. /// The "optimal" power at which the generator is considered to be at 100% efficiency.
  42. /// </summary>
  43. [DataField]
  44. public float OptimalPower = 15_000.0f;
  45. /// <summary>
  46. /// The rate at which one unit of fuel should be consumed.
  47. /// </summary>
  48. [DataField]
  49. public float OptimalBurnRate = 1 / 60.0f; // Once every 60 seconds.
  50. /// <summary>
  51. /// A constant used to calculate fuel efficiency in relation to target power output and optimal power output
  52. /// </summary>
  53. [DataField]
  54. public float FuelEfficiencyConstant = 1.3f;
  55. }