2023-04-23 23:35:19 -04:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
|
|
|
|
|
2023-04-23 12:25:12 +10:00
|
|
|
namespace Content.Server.PowerCell;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Indicates that the entity's ActivatableUI requires power or else it closes.
|
|
|
|
|
/// </summary>
|
2023-04-30 02:06:44 -04:00
|
|
|
[RegisterComponent, Access(typeof(PowerCellSystem))]
|
2023-04-23 12:25:12 +10:00
|
|
|
public sealed class PowerCellDrawComponent : Component
|
|
|
|
|
{
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite), DataField("enabled")]
|
2023-04-30 02:06:44 -04:00
|
|
|
public bool Enabled;
|
2023-04-23 12:25:12 +10:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How much the entity draws while the UI is open.
|
|
|
|
|
/// Set to 0 if you just wish to check for power upon opening the UI.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite), DataField("drawRate")]
|
|
|
|
|
public float DrawRate = 1f;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How much power is used whenever the entity is "used".
|
|
|
|
|
/// This is used to ensure the UI won't open again without a minimum use power.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite), DataField("useRate")]
|
2023-04-30 02:06:44 -04:00
|
|
|
public float UseRate;
|
2023-04-23 23:35:19 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// When the next automatic power draw will occur
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("nextUpdate", customTypeSerializer: typeof(TimeOffsetSerializer))]
|
|
|
|
|
public TimeSpan NextUpdateTime;
|
2023-04-23 12:25:12 +10:00
|
|
|
}
|