2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.APC;
|
2019-04-15 21:11:38 -06:00
|
|
|
using Robust.Client.GameObjects;
|
2018-07-17 11:39:55 +02:00
|
|
|
|
2021-07-04 18:11:52 +02:00
|
|
|
namespace Content.Client.Power.APC
|
2018-07-17 11:39:55 +02:00
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class ApcVisualizer : AppearanceVisualizer
|
2018-07-17 11:39:55 +02:00
|
|
|
{
|
2022-01-15 11:32:46 -07:00
|
|
|
public static readonly Color LackColor = Color.FromHex("#d1332e");
|
|
|
|
|
public static readonly Color ChargingColor = Color.FromHex("#2e8ad1");
|
|
|
|
|
public static readonly Color FullColor = Color.FromHex("#3db83b");
|
2022-02-17 21:43:24 -05:00
|
|
|
public static readonly Color EmagColor = Color.FromHex("#1f48d6");
|
2022-01-15 11:32:46 -07:00
|
|
|
|
2022-08-14 07:28:34 +02:00
|
|
|
[Obsolete("Subscribe to AppearanceChangeEvent instead.")]
|
2018-07-17 11:39:55 +02:00
|
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
|
|
|
{
|
|
|
|
|
base.OnChangeData(component);
|
|
|
|
|
|
2022-01-15 11:32:46 -07:00
|
|
|
var ent = IoCManager.Resolve<IEntityManager>();
|
2023-01-15 13:38:53 +11:00
|
|
|
var sprite = ent.GetComponent<SpriteComponent>(component.Owner);
|
2022-09-10 05:27:41 +02:00
|
|
|
if (component.TryGetData<ApcChargeState>(ApcVisuals.ChargeState, out var chargeState))
|
2018-07-17 11:39:55 +02:00
|
|
|
{
|
2022-01-15 11:32:46 -07:00
|
|
|
if (ent.TryGetComponent(component.Owner, out SharedPointLightComponent? light))
|
|
|
|
|
{
|
2022-09-10 05:27:41 +02:00
|
|
|
light.Color = chargeState switch
|
2022-01-15 11:32:46 -07:00
|
|
|
{
|
|
|
|
|
ApcChargeState.Lack => LackColor,
|
|
|
|
|
ApcChargeState.Charging => ChargingColor,
|
|
|
|
|
ApcChargeState.Full => FullColor,
|
2022-02-17 21:43:24 -05:00
|
|
|
ApcChargeState.Emag => EmagColor,
|
2022-01-15 11:32:46 -07:00
|
|
|
_ => LackColor
|
|
|
|
|
};
|
|
|
|
|
}
|
2018-07-17 11:39:55 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-20 09:42:22 +03:00
|
|
|
enum ApcVisualLayers : byte
|
2018-07-17 11:39:55 +02:00
|
|
|
{
|
|
|
|
|
ChargeState,
|
|
|
|
|
Lock,
|
|
|
|
|
Equipment,
|
|
|
|
|
Lighting,
|
|
|
|
|
Environment,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|