2024-01-17 12:00:25 +03:00
|
|
|
using System.Numerics;
|
2024-01-13 12:24:00 +03:00
|
|
|
using Content.Shared.Ghost;
|
2024-01-28 18:37:24 +07:00
|
|
|
using Content.Shared._White.CustomGhostSystem;
|
2023-05-01 17:32:16 +06:00
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
|
2024-01-28 17:32:55 +07:00
|
|
|
namespace Content.Client._White.CustomGhostSpriteSystem;
|
2023-05-01 17:32:16 +06:00
|
|
|
|
|
|
|
|
public sealed class CustomGhostVisualizer : VisualizerSystem<GhostComponent>
|
|
|
|
|
{
|
|
|
|
|
protected override void OnAppearanceChange(EntityUid uid, GhostComponent component, ref AppearanceChangeEvent args)
|
|
|
|
|
{
|
|
|
|
|
base.OnAppearanceChange(uid, component, ref args);
|
|
|
|
|
|
|
|
|
|
if(args.Sprite == null) return;
|
|
|
|
|
|
|
|
|
|
if (AppearanceSystem.TryGetData<string>(uid, CustomGhostAppearance.Sprite, out var rsiPath, args.Component))
|
|
|
|
|
{
|
|
|
|
|
args.Sprite.LayerSetRSI(0, rsiPath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(AppearanceSystem.TryGetData<float>(uid, CustomGhostAppearance.AlphaOverride, out var alpha, args.Component))
|
|
|
|
|
{
|
|
|
|
|
args.Sprite.Color = args.Sprite.Color.WithAlpha(alpha);
|
|
|
|
|
}
|
2023-05-14 02:35:20 +03:00
|
|
|
|
|
|
|
|
if (AppearanceSystem.TryGetData<Vector2>(uid, CustomGhostAppearance.SizeOverride, out var size, args.Component))
|
|
|
|
|
{
|
|
|
|
|
args.Sprite.Scale = size;
|
|
|
|
|
}
|
2023-05-01 17:32:16 +06:00
|
|
|
}
|
|
|
|
|
}
|