using Content.Server.Power.EntitySystems;
using Content.Shared.Guidebook;
namespace Content.Server.Power.Components
{
///
/// Battery node on the pow3r network. Needs other components to connect to actual networks.
///
[RegisterComponent]
[Virtual]
[Access(typeof(BatterySystem))]
public partial class BatteryComponent : Component
{
public string SolutionName = "battery";
///
/// Maximum charge of the battery in joules (ie. watt seconds)
///
[DataField]
[GuidebookData]
public float MaxCharge;
///
/// Current charge of the battery in joules (ie. watt seconds)
///
[DataField("startingCharge")]
public float CurrentCharge;
///
/// The price per one joule. Default is 1 credit for 10kJ.
///
[DataField]
public float PricePerJoule = 0.0001f;
}
///
/// Raised when a battery's charge or capacity changes (capacity affects relative charge percentage).
///
[ByRefEvent]
public readonly record struct ChargeChangedEvent(float Charge, float MaxCharge);
///
/// Raised when it is necessary to get information about battery charges.
///
[ByRefEvent]
public sealed class GetChargeEvent : EntityEventArgs
{
public float CurrentCharge;
public float MaxCharge;
}
///
/// Raised when it is necessary to change the current battery charge to a some value.
///
[ByRefEvent]
public sealed class ChangeChargeEvent : EntityEventArgs
{
public float OriginalValue;
public float ResidualValue;
public ChangeChargeEvent(float value)
{
OriginalValue = value;
ResidualValue = value;
}
}
}