* Cleanup warnings in DamageMarkerSystem * Cleanup warnings in CuffableSystem * Cleanup warnings in DeployableTurretSystem * Cleanup warnings in StorageContainerVisualsSystem * Cleanup warnings in ItemMapperSystem * Cleanup warnings in ItemCounterSystem * Cleanup warnings in RandomSpriteSystem * Cleanup warnings in PowerCellSystem * Cleanup warnings in ParticleAcceleratorPartVisualizerSystem * Cleanup warnings in PaperVisualizerSystem * Cleanup warnings in PoweredLightVisualizerSystem * Cleanup warnings in LightBulbSystem * Cleanup warnings in EmergencyLightSystem * Cleanup warnings in DoorSystem * Cleanup warnings in ClockSystem * Cleanup warnings in BuckleSystem * Cleanup warnings in JukeboxSystem
39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using Content.Shared.Light.Components;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Light.Visualizers;
|
|
|
|
public sealed class LightBulbSystem : VisualizerSystem<LightBulbComponent>
|
|
{
|
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
|
|
|
protected override void OnAppearanceChange(EntityUid uid, LightBulbComponent comp, ref AppearanceChangeEvent args)
|
|
{
|
|
if (args.Sprite == null)
|
|
return;
|
|
|
|
// update sprite state
|
|
if (AppearanceSystem.TryGetData<LightBulbState>(uid, LightBulbVisuals.State, out var state, args.Component))
|
|
{
|
|
switch (state)
|
|
{
|
|
case LightBulbState.Normal:
|
|
_sprite.LayerSetRsiState((uid, args.Sprite), LightBulbVisualLayers.Base, comp.NormalSpriteState);
|
|
break;
|
|
case LightBulbState.Broken:
|
|
_sprite.LayerSetRsiState((uid, args.Sprite), LightBulbVisualLayers.Base, comp.BrokenSpriteState);
|
|
break;
|
|
case LightBulbState.Burned:
|
|
_sprite.LayerSetRsiState((uid, args.Sprite), LightBulbVisualLayers.Base, comp.BurnedSpriteState);
|
|
break;
|
|
}
|
|
}
|
|
|
|
// also update sprites color
|
|
if (AppearanceSystem.TryGetData<Color>(uid, LightBulbVisuals.Color, out var color, args.Component))
|
|
{
|
|
_sprite.SetColor((uid, args.Sprite), color);
|
|
}
|
|
}
|
|
}
|