light refactoring/rework (#19314)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -1,62 +1,58 @@
|
||||
using Content.Server.Light.EntitySystems;
|
||||
using Content.Shared.Light.Component;
|
||||
using Content.Shared.Light.Components;
|
||||
|
||||
namespace Content.Server.Light.Components
|
||||
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
|
||||
{
|
||||
[ViewVariables]
|
||||
public EmergencyLightState State;
|
||||
|
||||
/// <summary>
|
||||
/// Component that represents an emergency light, it has an internal battery that charges when the power is on.
|
||||
/// Is this emergency light forced on for some reason and cannot be disabled through normal means
|
||||
/// (i.e. delta alert level?)
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(EmergencyLightSystem))]
|
||||
public sealed partial class EmergencyLightComponent : SharedEmergencyLightComponent
|
||||
public bool ForciblyEnabled = false;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("wattage")]
|
||||
public float Wattage = 5;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("chargingWattage")]
|
||||
public float ChargingWattage = 60;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("chargingEfficiency")]
|
||||
public float ChargingEfficiency = 0.85f;
|
||||
|
||||
public Dictionary<EmergencyLightState, string> BatteryStateText = new()
|
||||
{
|
||||
[ViewVariables]
|
||||
public EmergencyLightState State;
|
||||
{ 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" }
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is this emergency light forced on for some reason and cannot be disabled through normal means
|
||||
/// (i.e. delta alert level?)
|
||||
/// </summary>
|
||||
public bool ForciblyEnabled = false;
|
||||
public enum EmergencyLightState : byte
|
||||
{
|
||||
Charging,
|
||||
Full,
|
||||
Empty,
|
||||
On
|
||||
}
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("wattage")]
|
||||
public float Wattage = 5;
|
||||
public sealed class EmergencyLightEvent : EntityEventArgs
|
||||
{
|
||||
public EmergencyLightState State { get; }
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("chargingWattage")]
|
||||
public float ChargingWattage = 60;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("chargingEfficiency")]
|
||||
public float ChargingEfficiency = 0.85f;
|
||||
|
||||
public Dictionary<EmergencyLightState, string> BatteryStateText = new()
|
||||
{
|
||||
{ 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" }
|
||||
};
|
||||
}
|
||||
|
||||
public enum EmergencyLightState : byte
|
||||
public EmergencyLightEvent(EmergencyLightState state)
|
||||
{
|
||||
Charging,
|
||||
Full,
|
||||
Empty,
|
||||
On
|
||||
}
|
||||
|
||||
public sealed class EmergencyLightEvent : EntityEventArgs
|
||||
{
|
||||
public EmergencyLightComponent Component { get; }
|
||||
|
||||
public EmergencyLightState State { get; }
|
||||
|
||||
public EmergencyLightEvent(EmergencyLightComponent component, EmergencyLightState state)
|
||||
{
|
||||
Component = component;
|
||||
State = state;
|
||||
}
|
||||
State = state;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user