using Content.Client.Alerts; using Content.Client.UserInterface.Systems.Alerts.Controls; using Content.Shared.Changeling; using Content.Shared.StatusIcon.Components; using Robust.Shared.Prototypes; namespace Content.Client.Changeling; public sealed class ChangelingSystem : SharedChangelingSystem { private const int MaxChemicalsNormalizer = 18; private const int MaxBiomassNormalizer = 16; [Dependency] private readonly IPrototypeManager _prototype = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnUpdateAlert); SubscribeLocalEvent(GetChanglingIcon); } private void OnUpdateAlert(EntityUid uid, ChangelingComponent comp, ref UpdateAlertSpriteEvent args) { var stateNormalized = 0f; // hardcoded because uhh umm i don't know. send help. switch (args.Alert.AlertKey.AlertType) { case "ChangelingChemicals": stateNormalized = (int) (comp.Chemicals / comp.MaxChemicals * MaxChemicalsNormalizer); break; default: return; } var sprite = args.SpriteViewEnt.Comp; sprite.LayerSetState(AlertVisualLayers.Base, $"{stateNormalized}"); } private void GetChanglingIcon(Entity ent, ref GetStatusIconsEvent args) { if (HasComp(ent) && _prototype.TryIndex(ent.Comp.StatusIcon, out var iconPrototype)) args.StatusIcons.Add(iconPrototype); } }