Many lighting tweaks (#4709)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user