* 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 * тяжело... * пу-пу-пу * mf og * Update radio_channels.yml --------- Co-authored-by: whateverusername0 <whateveremail> Co-authored-by: username <113782077+whateverusername0@users.noreply.github.com>
47 lines
1.6 KiB
C#
47 lines
1.6 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)
|
|
{
|
|
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 * 18);
|
|
break;
|
|
|
|
case "ChangelingBiomass":
|
|
stateNormalized = (int)(comp.Biomass / comp.MaxBiomass * 16);
|
|
break;
|
|
default:
|
|
return;
|
|
}
|
|
var sprite = args.SpriteViewEnt.Comp;
|
|
sprite.LayerSetState(AlertVisualLayers.Base, $"{stateNormalized}");
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|