[feat] Custom ghost sprite

This commit is contained in:
rhailrake
2023-05-01 17:32:16 +06:00
committed by Aviu00
parent 413f51d5f5
commit cc985e57be
11 changed files with 259 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
using Content.Client.Ghost;
using Content.Shared.White.CustomGhostSystem;
using Robust.Client.GameObjects;
namespace Content.Client.White.CustomGhostSpriteSystem;
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);
}
}
}