Files
Delta-v/Content.Client/_DV/Body/ResurrectWhenAbleSystem.cs
T
William Lemonandpre-commit-ci[bot] bc8f5a7a20 Even More Skia Tweaks (#4355)
* More Skia tweaks

* Swapped whitelist for EntityWhitelist

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-11 06:02:48 +00:00

34 lines
1.1 KiB
C#

using Content.Shared._DV.Body;
using Content.Shared.Alert;
using Robust.Client.Player;
using Robust.Shared.Prototypes;
public sealed partial class ResurrectWhenAbleSystem : EntitySystem
{
[Dependency] private readonly AlertsSystem _alerts = default!;
[Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
private ProtoId<AlertPrototype> _resurrectingIcon = "ResurrectingIcon";
public override void Update(float frameTime)
{
base.Update(frameTime);
if (_player.LocalSession?.AttachedEntity is not { } ent)
return;
if (!TryComp<ResurrectWhenAbleComponent>(ent, out var comp))
return;
if (comp.ResurrectAt is not { } resurrectTime)
{
_alerts.ClearAlert(ent, _resurrectingIcon);
return;
}
var alertProto = _prototype.Index(_resurrectingIcon);
_alerts.ShowAlert(ent, alertProto, cooldown: (resurrectTime - TimeSpan.FromSeconds(comp.TimeToResurrect), resurrectTime));
}
}