* init * fix vampire polymorph * fix vampire metabolizm * upd * теперь при бане будет указываться номер раунда, хд * fix * fix * fix locale * change speed * new nukeops shuttle * FULLY FIX EBANY VAMPIRE OBJECTIVES * fix faction * fix drank objective * try fix status icon * fix changelings * fix zombie faction * vampire status icon fix * upd roadmap * vampire blood amount alert * drain objective up * upd * upd
42 lines
No EOL
1.5 KiB
C#
42 lines
No EOL
1.5 KiB
C#
using System.Linq;
|
|
using Content.Client.Alerts;
|
|
using Content.Client.UserInterface.Systems.Alerts.Controls;
|
|
using Content.Shared.StatusIcon;
|
|
using Content.Shared.StatusIcon.Components;
|
|
using Content.Shared.Vampire;
|
|
using Content.Shared.Vampire.Components;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.Vampire;
|
|
|
|
public sealed class VampireSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<VampireIconComponent, GetStatusIconsEvent>(GetVampireIcon);
|
|
SubscribeLocalEvent<VampireAlertComponent, UpdateAlertSpriteEvent>(OnUpdateAlert);
|
|
}
|
|
|
|
private void GetVampireIcon(EntityUid uid, VampireIconComponent component, ref GetStatusIconsEvent args)
|
|
{
|
|
var iconPrototype = _prototype.Index(component.StatusIcon);
|
|
args.StatusIcons.Add(iconPrototype);
|
|
}
|
|
|
|
private void OnUpdateAlert(EntityUid uid, VampireAlertComponent component, ref UpdateAlertSpriteEvent args)
|
|
{
|
|
if (args.Alert.ID != component.BloodAlert)
|
|
return;
|
|
|
|
var sprite = args.SpriteViewEnt.Comp;
|
|
var blood = Math.Clamp(component.BloodAmount, 0, 999);
|
|
sprite.LayerSetState(VampireVisualLayers.Digit1, $"{(blood / 100) % 10}");
|
|
sprite.LayerSetState(VampireVisualLayers.Digit2, $"{(blood / 10) % 10}");
|
|
sprite.LayerSetState(VampireVisualLayers.Digit3, $"{blood % 10}");
|
|
}
|
|
} |