Files
OldThink/Content.Client/Miracle/Changeling/ChemicalsAlertSystem.cs
Aviu00 6272da2bb3 Fixes (#289)
* - fix: Ling fixes.

* - fix: Fix ghasp identity.

* - fix: Low temp slowdown fix.

* - fix: Crossbow fix.

* - fix: Fix gamerules.

* - fix: Fix shadow shackles.

* - fix: Cleanup refund.

* - fix: Can't pry runic door.

* - fix: Fix crash.

* - fix: Fix mood.

* - fix: Fix dictionary.
2024-04-21 18:07:27 +03:00

29 lines
955 B
C#

using Content.Client.Alerts;
using Content.Shared.Alert;
using Content.Shared.Changeling;
using Content.Shared.Revenant;
namespace Content.Client.Miracle.Changeling;
public sealed class ChemicalsAlertSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ChangelingComponent, UpdateAlertSpriteEvent>(OnUpdateAlert);
}
private void OnUpdateAlert(Entity<ChangelingComponent> ent, ref UpdateAlertSpriteEvent args)
{
if (args.Alert.AlertType != AlertType.Chemicals)
return;
var sprite = args.SpriteViewEnt.Comp;
var chemicals = Math.Clamp(ent.Comp.ChemicalsBalance, 0, 999);
sprite.LayerSetState(RevenantVisualLayers.Digit1, $"{(chemicals / 100) % 10}");
sprite.LayerSetState(RevenantVisualLayers.Digit2, $"{(chemicals / 10) % 10}");
sprite.LayerSetState(RevenantVisualLayers.Digit3, $"{chemicals % 10}");
}
}