* real? * ok * real 2 * one more thing that i forgot to port part 2 * i am dumb * mofo og * waaaagh * some rework placeholders * porting part 2 * bruh. * bruh 2 * bruh 3. * Update ChangelingRuleSystem.cs * Update AdminVerbSystem.Antags.cs * говнокрад это SubGamemode * тяжело... * пу-пу-пу --------- Co-authored-by: whateverusername0 <whateveremail> Co-authored-by: username <113782077+whateverusername0@users.noreply.github.com>
36 lines
1.3 KiB
C#
36 lines
1.3 KiB
C#
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 partial class ChangelingSystem : EntitySystem
|
|
{
|
|
|
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<ChangelingComponent, UpdateAlertSpriteEvent>(OnUpdateAlert);
|
|
SubscribeLocalEvent<ChangelingComponent, GetStatusIconsEvent>(GetChanglingIcon);
|
|
}
|
|
|
|
private void OnUpdateAlert(EntityUid uid, ChangelingComponent comp, ref UpdateAlertSpriteEvent args)
|
|
{
|
|
if (args.Alert.AlertKey.AlertType != "Chemicals")
|
|
return;
|
|
|
|
var chemicalsNormalised = (int) (comp.Chemicals / comp.MaxChemicals * 16); // hardcoded because uhh umm
|
|
var sprite = args.SpriteViewEnt.Comp;
|
|
sprite.LayerSetState(AlertVisualLayers.Base, $"{chemicalsNormalised}");
|
|
}
|
|
|
|
private void GetChanglingIcon(Entity<ChangelingComponent> ent, ref GetStatusIconsEvent args)
|
|
{
|
|
if (HasComp<HivemindComponent>(ent) && _prototype.TryIndex(ent.Comp.StatusIcon, out var iconPrototype))
|
|
args.StatusIcons.Add(iconPrototype);
|
|
}
|
|
}
|