Converted BurnState Visualizer (#15661)

This commit is contained in:
Bixkitts
2023-04-29 11:09:11 +02:00
committed by GitHub
parent 18ff69146c
commit 83c9e2bb50
7 changed files with 54 additions and 68 deletions

View File

@@ -0,0 +1,25 @@
using Robust.Client.GameObjects;
using Content.Shared.Smoking;
namespace Content.Client.Smoking;
public sealed class BurnStateVisualizerSystem : VisualizerSystem<BurnStateVisualsComponent>
{
protected override void OnAppearanceChange(EntityUid uid, BurnStateVisualsComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;
if (!args.AppearanceData.TryGetValue(SmokingVisuals.Smoking, out var burnState))
return;
var state = burnState switch
{
SmokableState.Lit => component.LitIcon,
SmokableState.Burnt => component.BurntIcon,
_ => component.UnlitIcon
};
args.Sprite.LayerSetState(0, state);
}
}