CatStation/Content.Client/Light/EntitySystems/EmergencyLightSystem.cs
Whatstone d9ffbf1d03
Cleanup: AppearanceSystem.TryGetData to AppearanceChangeEvent.TryGetData (#45373)
* First impl. of appearance TryGetData cleanup

* Handful of fixes

* DamageVisuals: fix HandleDamage call, inheritdoc

* bunch of unused AppearanceSystem instances

* Handful more unused appearance systems, inheritdoc

* JetpackSystem: Ent<T>

* cleanup roundup, more Ent<T>

* a few lingering AppearanceSystem.TryGetData calls

* more lingering AppearanceData access

* Remove unnecessary inheritdoc

* once again, with feeling
2026-10-05 00:45:37 +00:00

26 lines
1 KiB
C#

using Content.Client.Light.Components;
using Content.Shared.Light.Components;
using Robust.Client.GameObjects;
namespace Content.Client.Light.EntitySystems;
public sealed partial class EmergencyLightSystem : VisualizerSystem<EmergencyLightComponent>
{
protected override void OnAppearanceChange(EntityUid uid, EmergencyLightComponent comp, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;
if (!args.TryGetData<bool>(EmergencyLightVisuals.On, out var on))
on = false;
SpriteSystem.LayerSetVisible((uid, args.Sprite), EmergencyLightVisualLayers.LightOff, !on);
SpriteSystem.LayerSetVisible((uid, args.Sprite), EmergencyLightVisualLayers.LightOn, on);
if (args.TryGetData<Color>(EmergencyLightVisuals.Color, out var color))
{
SpriteSystem.LayerSetColor((uid, args.Sprite), EmergencyLightVisualLayers.LightOn, color);
SpriteSystem.LayerSetColor((uid, args.Sprite), EmergencyLightVisualLayers.LightOff, color);
}
}
}