2022-05-16 14:41:23 +10:00
|
|
|
using Content.Shared.Storage;
|
2022-03-23 16:14:23 +03:00
|
|
|
using Content.Shared.Storage.Components;
|
|
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.Storage.Visualizers;
|
|
|
|
|
|
|
|
|
|
public sealed class StorageFillVisualizerSystem : VisualizerSystem<StorageFillVisualizerComponent>
|
|
|
|
|
{
|
|
|
|
|
protected override void OnAppearanceChange(EntityUid uid, StorageFillVisualizerComponent component, ref AppearanceChangeEvent args)
|
|
|
|
|
{
|
2022-05-16 14:41:23 +10:00
|
|
|
if (args.Sprite == null)
|
|
|
|
|
return;
|
2022-03-23 16:14:23 +03:00
|
|
|
|
|
|
|
|
if (!TryComp(uid, out SpriteComponent? sprite))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!args.Component.TryGetData(StorageFillVisuals.FillLevel, out int level))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var state = $"{component.FillBaseName}-{level}";
|
2022-05-16 14:41:23 +10:00
|
|
|
args.Sprite.LayerSetState(StorageFillLayers.Fill, state);
|
2022-03-23 16:14:23 +03:00
|
|
|
}
|
|
|
|
|
}
|