mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-30 08:07:28 +00:00
* feat: Recent SSD indicator, SSD time in admin overlay * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * tweak: remove colon from ssd time loc string * feat: add another stage * feat: ssd examine text * apply suggestion: make ssdstage serializable, use proper doc comments Co-authored-by: pathetic meowmeow <uhhadd@gmail.com> Signed-off-by: DisposableCrewmember42 <disposablecrewmember42@proton.me> * apply suggestion: more compact switch, throw instead of logging if invalid stage Co-authored-by: pathetic meowmeow <uhhadd@gmail.com> Signed-off-by: DisposableCrewmember42 <disposablecrewmember42@proton.me> * apply suggestion: missing DeltaV comment Co-authored-by: Sir Warock <67167466+SirWarock@users.noreply.github.com> Signed-off-by: DisposableCrewmember42 <disposablecrewmember42@proton.me> * fix: add missing import * refactor: remove unnecessary state-keeping i don't remember why i did it like that * chore: remove unused import * refactor: don't separate comp from ent --------- Signed-off-by: DisposableCrewmember42 <disposablecrewmember42@proton.me> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: pathetic meowmeow <uhhadd@gmail.com> Co-authored-by: Sir Warock <67167466+SirWarock@users.noreply.github.com>
62 lines
2.3 KiB
C#
62 lines
2.3 KiB
C#
using Content.Shared._DV.Mind; // DeltaV
|
|
using Content.Shared.CCVar; // DeltaV
|
|
using Content.Shared.Mind.Components;
|
|
using Content.Shared.Mobs.Systems;
|
|
using Content.Shared.NPC;
|
|
using Content.Shared.SSDIndicator;
|
|
using Content.Shared.StatusIcon;
|
|
using Content.Shared.StatusIcon.Components;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.SSDIndicator;
|
|
|
|
/// <summary>
|
|
/// Handles displaying SSD indicator as status icon
|
|
/// </summary>
|
|
public sealed class SSDIndicatorSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
|
[Dependency] private readonly Shared.SSDIndicator.SSDIndicatorSystem _shared = default!; // DeltaV - SSD Recency, don't want to rename the upstream class
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<SSDIndicatorComponent, GetStatusIconsEvent>(OnGetStatusIcon);
|
|
}
|
|
|
|
private void OnGetStatusIcon(EntityUid uid, SSDIndicatorComponent component, ref GetStatusIconsEvent args)
|
|
{
|
|
if (component.IsSSD &&
|
|
_cfg.GetCVar(CCVars.ICShowSSDIndicator) &&
|
|
!_mobState.IsDead(uid) &&
|
|
!HasComp<ActiveNPCComponent>(uid) &&
|
|
HasComp<MindExaminableComponent>(uid))
|
|
{
|
|
// Begin DeltaV Additions
|
|
var ev = new ShowSSDIndicatorEvent();
|
|
RaiseLocalEvent(uid, ref ev);
|
|
if (ev.Hidden)
|
|
return;
|
|
|
|
// SSD Recency Indicator
|
|
var stage = _shared.GetStage(new Entity<SSDIndicatorComponent>(uid, component));
|
|
var icon = stage switch
|
|
{
|
|
SsdStage.VeryRecent => component.VeryRecentIcon,
|
|
SsdStage.Recent => component.RecentIcon,
|
|
SsdStage.Cryoable => component.Icon,
|
|
_ => throw new InvalidOperationException($"{ToPrettyString(uid)} has an invalid SSD stage {stage}."),
|
|
};
|
|
|
|
args.StatusIcons.Add(_prototype.Index(icon));
|
|
// End DeltaV Additions
|
|
|
|
// args.StatusIcons.Add(_prototype.Index(component.Icon)); // DeltaV - commented out. status icon now added above
|
|
}
|
|
}
|
|
}
|