Resolves TabletopItemVisualizer is Obsolete (#13911)

This commit is contained in:
TemporalOroboros
2023-02-03 06:47:29 -08:00
committed by GitHub
parent 1808b640ed
commit 0edbc21ce8
7 changed files with 34 additions and 41 deletions

View File

@@ -0,0 +1,25 @@
using Content.Shared.Tabletop;
using Robust.Client.GameObjects;
namespace Content.Client.Tabletop.Visualizers;
public sealed class TabletopItemVisualizerSystem : VisualizerSystem<TabletopItemVisualizerComponent>
{
protected override void OnAppearanceChange(EntityUid uid, TabletopItemVisualizerComponent comp, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;
// TODO: maybe this can work more nicely, by maybe only having to set the item to "being dragged", and have
// the appearance handle the rest
if (AppearanceSystem.TryGetData<Vector2>(uid, TabletopItemVisuals.Scale, out var scale, args.Component))
{
args.Sprite.Scale = scale;
}
if (AppearanceSystem.TryGetData<int>(uid, TabletopItemVisuals.DrawDepth, out var drawDepth, args.Component))
{
args.Sprite.DrawDepth = drawDepth;
}
}
}