1
0

BurnStateVisualizerSystem.cs 751 B

12345678910111213141516171819202122232425
  1. using Robust.Client.GameObjects;
  2. using Content.Shared.Smoking;
  3. namespace Content.Client.Smoking;
  4. public sealed class BurnStateVisualizerSystem : VisualizerSystem<BurnStateVisualsComponent>
  5. {
  6. protected override void OnAppearanceChange(EntityUid uid, BurnStateVisualsComponent component, ref AppearanceChangeEvent args)
  7. {
  8. if (args.Sprite == null)
  9. return;
  10. if (!args.AppearanceData.TryGetValue(SmokingVisuals.Smoking, out var burnState))
  11. return;
  12. var state = burnState switch
  13. {
  14. SmokableState.Lit => component.LitIcon,
  15. SmokableState.Burnt => component.BurntIcon,
  16. _ => component.UnlitIcon
  17. };
  18. args.Sprite.LayerSetState(0, state);
  19. }
  20. }