2022-03-28 15:02:57 +11:00
|
|
|
using Content.Server.Light.EntitySystems;
|
2023-09-04 06:31:10 +01:00
|
|
|
using Content.Shared.Light.Components;
|
2020-08-22 12:06:29 +02:00
|
|
|
|
2023-09-04 06:31:10 +01:00
|
|
|
namespace Content.Server.Light.Components;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Component that represents an emergency light, it has an internal battery that charges when the power is on.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RegisterComponent, Access(typeof(EmergencyLightSystem))]
|
|
|
|
|
public sealed partial class EmergencyLightComponent : SharedEmergencyLightComponent
|
2020-08-22 12:06:29 +02:00
|
|
|
{
|
2023-09-04 06:31:10 +01:00
|
|
|
[ViewVariables]
|
|
|
|
|
public EmergencyLightState State;
|
|
|
|
|
|
2020-08-22 12:06:29 +02:00
|
|
|
/// <summary>
|
2023-09-04 06:31:10 +01:00
|
|
|
/// Is this emergency light forced on for some reason and cannot be disabled through normal means
|
2024-04-18 06:50:08 -04:00
|
|
|
/// (i.e. blue alert or higher?)
|
2020-08-22 12:06:29 +02:00
|
|
|
/// </summary>
|
2023-09-04 06:31:10 +01:00
|
|
|
public bool ForciblyEnabled = false;
|
2020-10-11 22:11:18 +11:00
|
|
|
|
2023-09-04 06:31:10 +01:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[DataField("wattage")]
|
|
|
|
|
public float Wattage = 5;
|
|
|
|
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[DataField("chargingWattage")]
|
|
|
|
|
public float ChargingWattage = 60;
|
2022-03-28 15:02:57 +11:00
|
|
|
|
2023-09-04 06:31:10 +01:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[DataField("chargingEfficiency")]
|
|
|
|
|
public float ChargingEfficiency = 0.85f;
|
|
|
|
|
|
|
|
|
|
public Dictionary<EmergencyLightState, string> BatteryStateText = new()
|
2020-10-11 22:11:18 +11:00
|
|
|
{
|
2023-09-04 06:31:10 +01:00
|
|
|
{ EmergencyLightState.Full, "emergency-light-component-light-state-full" },
|
|
|
|
|
{ EmergencyLightState.Empty, "emergency-light-component-light-state-empty" },
|
|
|
|
|
{ EmergencyLightState.Charging, "emergency-light-component-light-state-charging" },
|
|
|
|
|
{ EmergencyLightState.On, "emergency-light-component-light-state-on" }
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-10-11 13:51:42 +02:00
|
|
|
|
2023-09-04 06:31:10 +01:00
|
|
|
public enum EmergencyLightState : byte
|
|
|
|
|
{
|
|
|
|
|
Charging,
|
|
|
|
|
Full,
|
|
|
|
|
Empty,
|
|
|
|
|
On
|
|
|
|
|
}
|
2020-10-11 22:11:18 +11:00
|
|
|
|
2023-09-04 06:31:10 +01:00
|
|
|
public sealed class EmergencyLightEvent : EntityEventArgs
|
|
|
|
|
{
|
|
|
|
|
public EmergencyLightState State { get; }
|
|
|
|
|
|
|
|
|
|
public EmergencyLightEvent(EmergencyLightState state)
|
|
|
|
|
{
|
|
|
|
|
State = state;
|
2020-10-11 22:11:18 +11:00
|
|
|
}
|
2020-08-22 12:06:29 +02:00
|
|
|
}
|