ECS APCs (#6118)
This commit is contained in:
@@ -3,11 +3,16 @@ using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Client.Power.APC
|
||||
{
|
||||
public class ApcVisualizer : AppearanceVisualizer
|
||||
{
|
||||
public static readonly Color LackColor = Color.FromHex("#d1332e");
|
||||
public static readonly Color ChargingColor = Color.FromHex("#2e8ad1");
|
||||
public static readonly Color FullColor = Color.FromHex("#3db83b");
|
||||
|
||||
[UsedImplicitly]
|
||||
public override void InitializeEntity(EntityUid entity)
|
||||
{
|
||||
@@ -35,7 +40,8 @@ namespace Content.Client.Power.APC
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner);
|
||||
var ent = IoCManager.Resolve<IEntityManager>();
|
||||
var sprite = ent.GetComponent<ISpriteComponent>(component.Owner);
|
||||
if (component.TryGetData<ApcChargeState>(ApcVisuals.ChargeState, out var state))
|
||||
{
|
||||
switch (state)
|
||||
@@ -50,6 +56,17 @@ namespace Content.Client.Power.APC
|
||||
sprite.LayerSetState(Layers.ChargeState, "apco3-2");
|
||||
break;
|
||||
}
|
||||
|
||||
if (ent.TryGetComponent(component.Owner, out SharedPointLightComponent? light))
|
||||
{
|
||||
light.Color = state switch
|
||||
{
|
||||
ApcChargeState.Lack => LackColor,
|
||||
ApcChargeState.Charging => ChargingColor,
|
||||
ApcChargeState.Full => FullColor,
|
||||
_ => LackColor
|
||||
};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user