2022-05-09 08:51:52 +03:00
|
|
|
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;
|
|
|
|
|
|
2023-02-02 17:34:53 +01:00
|
|
|
AppearanceSystem.TryGetData<bool>(uid, WeldableVisuals.IsWelded, out var isWelded, args.Component);
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|