2021-07-04 18:11:52 +02:00
|
|
|
using Content.Server.Power.NodeGroups;
|
|
|
|
|
using Content.Server.Power.Pow3r;
|
2020-06-28 09:23:26 -06:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Power.Components
|
2020-06-28 09:23:26 -06:00
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
2023-08-25 20:40:42 +02:00
|
|
|
public sealed partial class PowerSupplierComponent : BaseNetConnectorComponent<IBasePowerNet>
|
2020-06-28 09:23:26 -06:00
|
|
|
{
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("supplyRate")]
|
2021-07-04 18:11:52 +02:00
|
|
|
public float MaxSupply { get => NetworkSupply.MaxSupply; set => NetworkSupply.MaxSupply = value; }
|
|
|
|
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[DataField("supplyRampTolerance")]
|
|
|
|
|
public float SupplyRampTolerance
|
|
|
|
|
{
|
|
|
|
|
get => NetworkSupply.SupplyRampTolerance;
|
|
|
|
|
set => NetworkSupply.SupplyRampTolerance = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[DataField("supplyRampRate")]
|
|
|
|
|
public float SupplyRampRate
|
|
|
|
|
{
|
|
|
|
|
get => NetworkSupply.SupplyRampRate;
|
|
|
|
|
set => NetworkSupply.SupplyRampRate = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[DataField("supplyRampPosition")]
|
|
|
|
|
public float SupplyRampPosition
|
|
|
|
|
{
|
|
|
|
|
get => NetworkSupply.SupplyRampPosition;
|
|
|
|
|
set => NetworkSupply.SupplyRampPosition = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[DataField("enabled")]
|
|
|
|
|
public bool Enabled
|
|
|
|
|
{
|
|
|
|
|
get => NetworkSupply.Enabled;
|
|
|
|
|
set => NetworkSupply.Enabled = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[ViewVariables] public float CurrentSupply => NetworkSupply.CurrentSupply;
|
|
|
|
|
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public PowerState.Supply NetworkSupply { get; } = new();
|
2020-06-28 09:23:26 -06:00
|
|
|
|
2023-08-25 20:40:42 +02:00
|
|
|
protected override void AddSelfToNet(IBasePowerNet powerNet)
|
2020-06-28 09:23:26 -06:00
|
|
|
{
|
|
|
|
|
powerNet.AddSupplier(this);
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-25 20:40:42 +02:00
|
|
|
protected override void RemoveSelfFromNet(IBasePowerNet powerNet)
|
2020-06-28 09:23:26 -06:00
|
|
|
{
|
|
|
|
|
powerNet.RemoveSupplier(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|