mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-02-15 03:31:44 +01:00
* refmbcult * fixrule * minich * yeee * linter * somefixes * cultext&gamb * linterfix * fixtarot
30 lines
987 B
C#
30 lines
987 B
C#
using Content.Shared.Card.Tarot;
|
|
using Content.Shared.Card.Tarot.Components;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Card.Tarot;
|
|
|
|
public sealed class CardTarotSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly AppearanceSystem _appearance = default!;
|
|
[Dependency] private readonly 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);
|
|
}
|
|
}
|