mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-06-09 10:06:49 +02:00
30 lines
977 B
C#
30 lines
977 B
C#
using Content.Shared.Card.Tarot;
|
|
using Content.Shared.Card.Tarot.Components;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Card.Tarot;
|
|
|
|
public sealed partial class CardTarotSystem : EntitySystem
|
|
{
|
|
[Dependency] private AppearanceSystem _appearance = default!;
|
|
[Dependency] private SpriteSystem _sprite = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<CardTarotComponent, AppearanceChangeEvent>(OnAppearanceChanged);
|
|
}
|
|
|
|
private void OnAppearanceChanged(Entity<CardTarotComponent> entity, ref AppearanceChangeEvent args)
|
|
{
|
|
if (!_appearance.TryGetData(entity, CardTarotVisuals.State, out CardTarot card)
|
|
|| !_appearance.TryGetData(entity, CardTarotVisuals.Reversed, out bool reversed))
|
|
return;
|
|
|
|
var state = card.ToString().ToLower();
|
|
if (reversed) state += "-reversed";
|
|
|
|
_sprite.LayerSetRsiState(entity.Owner, 0, state);
|
|
}
|
|
}
|