1
0

PowerSupplierComponent.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using Content.Server.Power.NodeGroups;
  2. using Content.Server.Power.Pow3r;
  3. using Content.Shared.Guidebook;
  4. namespace Content.Server.Power.Components
  5. {
  6. [RegisterComponent]
  7. public sealed partial class PowerSupplierComponent : BaseNetConnectorComponent<IBasePowerNet>
  8. {
  9. [ViewVariables(VVAccess.ReadWrite)]
  10. [DataField("supplyRate")]
  11. [GuidebookData]
  12. public float MaxSupply { get => NetworkSupply.MaxSupply; set => NetworkSupply.MaxSupply = value; }
  13. [ViewVariables(VVAccess.ReadWrite)]
  14. [DataField("supplyRampTolerance")]
  15. public float SupplyRampTolerance
  16. {
  17. get => NetworkSupply.SupplyRampTolerance;
  18. set => NetworkSupply.SupplyRampTolerance = value;
  19. }
  20. [ViewVariables(VVAccess.ReadWrite)]
  21. [DataField("supplyRampRate")]
  22. public float SupplyRampRate
  23. {
  24. get => NetworkSupply.SupplyRampRate;
  25. set => NetworkSupply.SupplyRampRate = value;
  26. }
  27. [ViewVariables(VVAccess.ReadWrite)]
  28. [DataField("supplyRampPosition")]
  29. public float SupplyRampPosition
  30. {
  31. get => NetworkSupply.SupplyRampPosition;
  32. set => NetworkSupply.SupplyRampPosition = value;
  33. }
  34. [ViewVariables(VVAccess.ReadWrite)]
  35. [DataField("enabled")]
  36. public bool Enabled
  37. {
  38. get => NetworkSupply.Enabled;
  39. set => NetworkSupply.Enabled = value;
  40. }
  41. [ViewVariables] public float CurrentSupply => NetworkSupply.CurrentSupply;
  42. [ViewVariables]
  43. public PowerState.Supply NetworkSupply { get; } = new();
  44. protected override void AddSelfToNet(IBasePowerNet powerNet)
  45. {
  46. powerNet.AddSupplier(this);
  47. }
  48. protected override void RemoveSelfFromNet(IBasePowerNet powerNet)
  49. {
  50. powerNet.RemoveSupplier(this);
  51. }
  52. }
  53. }