Files
Delta-v/Content.Client/Revenant/RevenantSystem.cs
T
KOTOB c6addd2e9e Port Cortical Borers (real) (#4466)
* ITS ALL C# GOOD LORD

BORN TO PORT
WORLD IS A PR
鬼神 Merge Em All 2025
I am yaml man
410,757,864,530 UPSTREAM MERGE CONFLICTS

* that was, uh. too easy.

* very small tweak

* comment and reuse fixes

* forgot the guidebook Oops

* the guidebookening

* the reusening
2025-10-16 16:11:24 +11:00

56 lines
1.9 KiB
C#

using Content.Client.Alerts;
using Content.Shared.Alert;
using Content.Shared.Alert.Components;
using Content.Shared.Revenant;
using Content.Shared.Revenant.Components;
using Robust.Client.GameObjects;
namespace Content.Client.Revenant;
public sealed class RevenantSystem : EntitySystem
{
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SpriteSystem _sprite = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RevenantComponent, AppearanceChangeEvent>(OnAppearanceChange);
SubscribeLocalEvent<RevenantComponent, GetGenericAlertCounterAmountEvent>(OnGetCounterAmount);
}
private void OnAppearanceChange(EntityUid uid, RevenantComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;
if (_appearance.TryGetData<bool>(uid, RevenantVisuals.Harvesting, out var harvesting, args.Component) && harvesting)
{
_sprite.LayerSetRsiState((uid, args.Sprite), 0, component.HarvestingState);
}
else if (_appearance.TryGetData<bool>(uid, RevenantVisuals.Stunned, out var stunned, args.Component) && stunned)
{
_sprite.LayerSetRsiState((uid, args.Sprite), 0, component.StunnedState);
}
else if (_appearance.TryGetData<bool>(uid, RevenantVisuals.Corporeal, out var corporeal, args.Component))
{
if (corporeal)
_sprite.LayerSetRsiState((uid, args.Sprite), 0, component.CorporealState);
else
_sprite.LayerSetRsiState((uid, args.Sprite), 0, component.State);
}
}
private void OnGetCounterAmount(Entity<RevenantComponent> ent, ref GetGenericAlertCounterAmountEvent args)
{
if (args.Handled)
return;
if (ent.Comp.EssenceAlert != args.Alert)
return;
args.Amount = ent.Comp.Essence.Int();
}
}