2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Power.Components;
|
|
|
|
|
using Content.Shared.Power;
|
2020-06-28 09:23:26 -06:00
|
|
|
|
2023-05-01 08:21:49 -07:00
|
|
|
namespace Content.Server.Power.SMES;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Handles the "user-facing" side of the actual SMES object.
|
|
|
|
|
/// This is operations that are specific to the SMES, like UI and visuals.
|
2023-05-06 20:43:41 -07:00
|
|
|
/// Logic is handled in <see cref="SmesSystem"/>
|
2023-05-01 08:21:49 -07:00
|
|
|
/// Code interfacing with the powernet is handled in <see cref="BatteryStorageComponent"/> and <see cref="BatteryDischargerComponent"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RegisterComponent, Access(typeof(SmesSystem))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class SmesComponent : Component
|
2020-06-28 09:23:26 -06:00
|
|
|
{
|
2023-05-01 08:21:49 -07:00
|
|
|
[ViewVariables]
|
|
|
|
|
public ChargeState LastChargeState;
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public TimeSpan LastChargeStateTime;
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public int LastChargeLevel;
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public TimeSpan LastChargeLevelTime;
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public TimeSpan VisualsChangeDelay = TimeSpan.FromSeconds(1);
|
2023-05-06 20:43:41 -07:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The number of distinct charge levels a SMES has.
|
|
|
|
|
/// 0 is empty max is full.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("numChargeLevels")]
|
|
|
|
|
public int NumChargeLevels = 6;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The charge level of the SMES as of the most recent update.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public int ChargeLevel = 0;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the SMES is being charged/discharged/neither.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public ChargeState ChargeState = ChargeState.Still;
|
2020-06-28 09:23:26 -06:00
|
|
|
}
|