2022-05-09 08:51:52 +03:00
|
|
|
using Content.Client.Tools.Components;
|
|
|
|
|
using Content.Shared.Tools.Components;
|
|
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.Tools.Visualizers;
|
|
|
|
|
|
|
|
|
|
public sealed class WeldableVisualizerSystem : VisualizerSystem<WeldableComponent>
|
|
|
|
|
{
|
|
|
|
|
protected override void OnAppearanceChange(EntityUid uid, WeldableComponent component, ref AppearanceChangeEvent args)
|
|
|
|
|
{
|
2022-05-16 14:41:23 +10:00
|
|
|
if (args.Sprite == null)
|
2022-05-09 08:51:52 +03:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
args.Component.TryGetData(WeldableVisuals.IsWelded, out bool isWelded);
|
2022-05-16 14:41:23 +10:00
|
|
|
if (args.Sprite.LayerMapTryGet(WeldableLayers.BaseWelded, out var layer))
|
2022-05-09 08:51:52 +03:00
|
|
|
{
|
2022-05-16 14:41:23 +10:00
|
|
|
args.Sprite.LayerSetVisible(layer, isWelded);
|
2022-05-09 08:51:52 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|