Many lighting tweaks (#4709)

This commit is contained in:
mirrorcult
2021-10-01 13:59:06 -07:00
committed by GitHub
parent f07bd6b005
commit 402cd9b56b
18 changed files with 207 additions and 13 deletions

View File

@@ -49,6 +49,10 @@ namespace Content.Server.Power.Components
private const int VisualsChangeDelay = 1;
private static readonly Color LackColor = Color.FromHex("#d1332e");
private static readonly Color ChargingColor = Color.FromHex("#2e8ad1");
private static readonly Color FullColor = Color.FromHex("#3db83b");
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ApcUiKey.Key);
public BatteryComponent? Battery => Owner.TryGetComponent(out BatteryComponent? batteryComponent) ? batteryComponent : null;
@@ -115,6 +119,18 @@ namespace Content.Server.Power.Components
{
appearance.SetData(ApcVisuals.ChargeState, newState);
}
if (Owner.TryGetComponent(out SharedPointLightComponent? light))
{
light.Color = newState switch
{
ApcChargeState.Lack => LackColor,
ApcChargeState.Charging => ChargingColor,
ApcChargeState.Full => FullColor,
_ => LackColor
};
light.Dirty();
}
}
Owner.TryGetComponent(out BatteryComponent? battery);