Refactor status icons take 2, cyborgs don't see criminal status (#26207)
* Initial commit. * review --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
28
Content.Client/Overlays/ShowCriminalRecordIconsSystem.cs
Normal file
28
Content.Client/Overlays/ShowCriminalRecordIconsSystem.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Content.Shared.Overlays;
|
||||
using Content.Shared.Security.Components;
|
||||
using Content.Shared.StatusIcon;
|
||||
using Content.Shared.StatusIcon.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.Overlays;
|
||||
|
||||
public sealed class ShowCriminalRecordIconsSystem : EquipmentHudSystem<ShowCriminalRecordIconsComponent>
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CriminalRecordComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
|
||||
}
|
||||
|
||||
private void OnGetStatusIconsEvent(EntityUid uid, CriminalRecordComponent component, ref GetStatusIconsEvent ev)
|
||||
{
|
||||
if (!IsActive || ev.InContainer)
|
||||
return;
|
||||
|
||||
if (_prototype.TryIndex<StatusIconPrototype>(component.StatusIcon.Id, out var iconPrototype))
|
||||
ev.StatusIcons.Add(iconPrototype);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
using Content.Shared.Nutrition.EntitySystems;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Overlays;
|
||||
using Content.Shared.StatusIcon;
|
||||
using Content.Shared.StatusIcon.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.Overlays;
|
||||
|
||||
public sealed class ShowHungerIconsSystem : EquipmentHudSystem<ShowHungerIconsComponent>
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeMan = default!;
|
||||
[Dependency] private readonly HungerSystem _hunger = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -17,42 +16,12 @@ public sealed class ShowHungerIconsSystem : EquipmentHudSystem<ShowHungerIconsCo
|
||||
SubscribeLocalEvent<HungerComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
|
||||
}
|
||||
|
||||
private void OnGetStatusIconsEvent(EntityUid uid, HungerComponent hungerComponent, ref GetStatusIconsEvent args)
|
||||
private void OnGetStatusIconsEvent(EntityUid uid, HungerComponent component, ref GetStatusIconsEvent ev)
|
||||
{
|
||||
if (!IsActive || args.InContainer)
|
||||
if (!IsActive || ev.InContainer)
|
||||
return;
|
||||
|
||||
var hungerIcons = DecideHungerIcon(uid, hungerComponent);
|
||||
|
||||
args.StatusIcons.AddRange(hungerIcons);
|
||||
}
|
||||
|
||||
private IReadOnlyList<StatusIconPrototype> DecideHungerIcon(EntityUid uid, HungerComponent hungerComponent)
|
||||
{
|
||||
var result = new List<StatusIconPrototype>();
|
||||
|
||||
switch (hungerComponent.CurrentThreshold)
|
||||
{
|
||||
case HungerThreshold.Overfed:
|
||||
if (_prototypeMan.TryIndex<StatusIconPrototype>("HungerIconOverfed", out var overfed))
|
||||
{
|
||||
result.Add(overfed);
|
||||
}
|
||||
break;
|
||||
case HungerThreshold.Peckish:
|
||||
if (_prototypeMan.TryIndex<StatusIconPrototype>("HungerIconPeckish", out var peckish))
|
||||
{
|
||||
result.Add(peckish);
|
||||
}
|
||||
break;
|
||||
case HungerThreshold.Starving:
|
||||
if (_prototypeMan.TryIndex<StatusIconPrototype>("HungerIconStarving", out var starving))
|
||||
{
|
||||
result.Add(starving);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
if (_hunger.TryGetStatusIconPrototype(component, out var iconPrototype))
|
||||
ev.StatusIcons.Add(iconPrototype);
|
||||
}
|
||||
}
|
||||
|
||||
60
Content.Client/Overlays/ShowJobIconsSystem.cs
Normal file
60
Content.Client/Overlays/ShowJobIconsSystem.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.Overlays;
|
||||
using Content.Shared.PDA;
|
||||
using Content.Shared.StatusIcon;
|
||||
using Content.Shared.StatusIcon.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.Overlays;
|
||||
|
||||
public sealed class ShowJobIconsSystem : EquipmentHudSystem<ShowJobIconsComponent>
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
|
||||
|
||||
[ValidatePrototypeId<StatusIconPrototype>]
|
||||
private const string JobIconForNoId = "JobIconNoId";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<StatusIconComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
|
||||
}
|
||||
|
||||
private void OnGetStatusIconsEvent(EntityUid uid, StatusIconComponent _, ref GetStatusIconsEvent ev)
|
||||
{
|
||||
if (!IsActive || ev.InContainer)
|
||||
return;
|
||||
|
||||
var iconId = JobIconForNoId;
|
||||
|
||||
if (_accessReader.FindAccessItemsInventory(uid, out var items))
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
// ID Card
|
||||
if (TryComp<IdCardComponent>(item, out var id))
|
||||
{
|
||||
iconId = id.JobIcon;
|
||||
break;
|
||||
}
|
||||
|
||||
// PDA
|
||||
if (TryComp<PdaComponent>(item, out var pda)
|
||||
&& pda.ContainedId != null
|
||||
&& TryComp(pda.ContainedId, out id))
|
||||
{
|
||||
iconId = id.JobIcon;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_prototype.TryIndex<StatusIconPrototype>(iconId, out var iconPrototype))
|
||||
ev.StatusIcons.Add(iconPrototype);
|
||||
else
|
||||
Log.Error($"Invalid job icon prototype: {iconPrototype}");
|
||||
}
|
||||
}
|
||||
28
Content.Client/Overlays/ShowMindShieldIconsSystem.cs
Normal file
28
Content.Client/Overlays/ShowMindShieldIconsSystem.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Content.Shared.Mindshield.Components;
|
||||
using Content.Shared.Overlays;
|
||||
using Content.Shared.StatusIcon;
|
||||
using Content.Shared.StatusIcon.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.Overlays;
|
||||
|
||||
public sealed class ShowMindShieldIconsSystem : EquipmentHudSystem<ShowMindShieldIconsComponent>
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<MindShieldComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
|
||||
}
|
||||
|
||||
private void OnGetStatusIconsEvent(EntityUid uid, MindShieldComponent component, ref GetStatusIconsEvent ev)
|
||||
{
|
||||
if (!IsActive || ev.InContainer)
|
||||
return;
|
||||
|
||||
if (_prototype.TryIndex<StatusIconPrototype>(component.MindShieldStatusIcon.Id, out var iconPrototype))
|
||||
ev.StatusIcons.Add(iconPrototype);
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.Mindshield.Components;
|
||||
using Content.Shared.Overlays;
|
||||
using Content.Shared.PDA;
|
||||
using Content.Shared.Security.Components;
|
||||
using Content.Shared.StatusIcon;
|
||||
using Content.Shared.StatusIcon.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.Overlays;
|
||||
|
||||
public sealed class ShowSecurityIconsSystem : EquipmentHudSystem<ShowSecurityIconsComponent>
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeMan = default!;
|
||||
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
|
||||
|
||||
[ValidatePrototypeId<StatusIconPrototype>]
|
||||
private const string JobIconForNoId = "JobIconNoId";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<StatusIconComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
|
||||
}
|
||||
|
||||
private void OnGetStatusIconsEvent(EntityUid uid, StatusIconComponent _, ref GetStatusIconsEvent @event)
|
||||
{
|
||||
if (!IsActive || @event.InContainer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var securityIcons = DecideSecurityIcon(uid);
|
||||
|
||||
@event.StatusIcons.AddRange(securityIcons);
|
||||
}
|
||||
|
||||
private IReadOnlyList<StatusIconPrototype> DecideSecurityIcon(EntityUid uid)
|
||||
{
|
||||
var result = new List<StatusIconPrototype>();
|
||||
|
||||
var jobIconToGet = JobIconForNoId;
|
||||
if (_accessReader.FindAccessItemsInventory(uid, out var items))
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
// ID Card
|
||||
if (TryComp(item, out IdCardComponent? id))
|
||||
{
|
||||
jobIconToGet = id.JobIcon;
|
||||
break;
|
||||
}
|
||||
|
||||
// PDA
|
||||
if (TryComp(item, out PdaComponent? pda)
|
||||
&& pda.ContainedId != null
|
||||
&& TryComp(pda.ContainedId, out id))
|
||||
{
|
||||
jobIconToGet = id.JobIcon;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_prototypeMan.TryIndex<StatusIconPrototype>(jobIconToGet, out var jobIcon))
|
||||
result.Add(jobIcon);
|
||||
else
|
||||
Log.Error($"Invalid job icon prototype: {jobIcon}");
|
||||
|
||||
if (TryComp<MindShieldComponent>(uid, out var comp))
|
||||
{
|
||||
if (_prototypeMan.TryIndex<StatusIconPrototype>(comp.MindShieldStatusIcon.Id, out var icon))
|
||||
result.Add(icon);
|
||||
}
|
||||
|
||||
if (TryComp<CriminalRecordComponent>(uid, out var record))
|
||||
{
|
||||
if(_prototypeMan.TryIndex<StatusIconPrototype>(record.StatusIcon.Id, out var criminalIcon))
|
||||
result.Add(criminalIcon);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
using Content.Shared.Overlays;
|
||||
using Content.Shared.StatusIcon.Components;
|
||||
using Content.Shared.NukeOps;
|
||||
using Content.Shared.StatusIcon;
|
||||
using Content.Shared.StatusIcon.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.Overlays;
|
||||
|
||||
public sealed class ShowSyndicateIconsSystem : EquipmentHudSystem<ShowSyndicateIconsComponent>
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
@@ -16,28 +17,13 @@ public sealed class ShowSyndicateIconsSystem : EquipmentHudSystem<ShowSyndicateI
|
||||
SubscribeLocalEvent<NukeOperativeComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
|
||||
}
|
||||
|
||||
private void OnGetStatusIconsEvent(EntityUid uid, NukeOperativeComponent nukeOperativeComponent, ref GetStatusIconsEvent args)
|
||||
private void OnGetStatusIconsEvent(EntityUid uid, NukeOperativeComponent component, ref GetStatusIconsEvent ev)
|
||||
{
|
||||
if (!IsActive || args.InContainer)
|
||||
{
|
||||
if (!IsActive || ev.InContainer)
|
||||
return;
|
||||
}
|
||||
|
||||
var syndicateIcons = SyndicateIcon(uid, nukeOperativeComponent);
|
||||
|
||||
args.StatusIcons.AddRange(syndicateIcons);
|
||||
}
|
||||
|
||||
private IReadOnlyList<StatusIconPrototype> SyndicateIcon(EntityUid uid, NukeOperativeComponent nukeOperativeComponent)
|
||||
{
|
||||
var result = new List<StatusIconPrototype>();
|
||||
|
||||
if (_prototype.TryIndex<StatusIconPrototype>(nukeOperativeComponent.SyndStatusIcon, out var syndicateicon))
|
||||
{
|
||||
result.Add(syndicateicon);
|
||||
}
|
||||
|
||||
return result;
|
||||
if (_prototype.TryIndex<StatusIconPrototype>(component.SyndStatusIcon, out var iconPrototype))
|
||||
ev.StatusIcons.Add(iconPrototype);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
using Content.Shared.Nutrition.EntitySystems;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Overlays;
|
||||
using Content.Shared.StatusIcon;
|
||||
using Content.Shared.StatusIcon.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.Overlays;
|
||||
|
||||
public sealed class ShowThirstIconsSystem : EquipmentHudSystem<ShowThirstIconsComponent>
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeMan = default!;
|
||||
[Dependency] private readonly ThirstSystem _thirst = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -17,42 +16,12 @@ public sealed class ShowThirstIconsSystem : EquipmentHudSystem<ShowThirstIconsCo
|
||||
SubscribeLocalEvent<ThirstComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
|
||||
}
|
||||
|
||||
private void OnGetStatusIconsEvent(EntityUid uid, ThirstComponent thirstComponent, ref GetStatusIconsEvent args)
|
||||
private void OnGetStatusIconsEvent(EntityUid uid, ThirstComponent component, ref GetStatusIconsEvent ev)
|
||||
{
|
||||
if (!IsActive || args.InContainer)
|
||||
if (!IsActive || ev.InContainer)
|
||||
return;
|
||||
|
||||
var thirstIcons = DecideThirstIcon(uid, thirstComponent);
|
||||
|
||||
args.StatusIcons.AddRange(thirstIcons);
|
||||
}
|
||||
|
||||
private IReadOnlyList<StatusIconPrototype> DecideThirstIcon(EntityUid uid, ThirstComponent thirstComponent)
|
||||
{
|
||||
var result = new List<StatusIconPrototype>();
|
||||
|
||||
switch (thirstComponent.CurrentThirstThreshold)
|
||||
{
|
||||
case ThirstThreshold.OverHydrated:
|
||||
if (_prototypeMan.TryIndex<StatusIconPrototype>("ThirstIconOverhydrated", out var overhydrated))
|
||||
{
|
||||
result.Add(overhydrated);
|
||||
}
|
||||
break;
|
||||
case ThirstThreshold.Thirsty:
|
||||
if (_prototypeMan.TryIndex<StatusIconPrototype>("ThirstIconThirsty", out var thirsty))
|
||||
{
|
||||
result.Add(thirsty);
|
||||
}
|
||||
break;
|
||||
case ThirstThreshold.Parched:
|
||||
if (_prototypeMan.TryIndex<StatusIconPrototype>("ThirstIconParched", out var parched))
|
||||
{
|
||||
result.Add(parched);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
if (_thirst.TryGetStatusIconPrototype(component, out var iconPrototype))
|
||||
ev.StatusIcons.Add(iconPrototype!);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,12 +38,14 @@ public partial class InventorySystem
|
||||
SubscribeLocalEvent<InventoryComponent, SolutionScanEvent>(RelayInventoryEvent);
|
||||
|
||||
// ComponentActivatedClientSystems
|
||||
SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowSecurityIconsComponent>>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowJobIconsComponent>>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowHealthBarsComponent>>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowHealthIconsComponent>>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowHungerIconsComponent>>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowThirstIconsComponent>>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowMindShieldIconsComponent>>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowSyndicateIconsComponent>>(RelayInventoryEvent);
|
||||
SubscribeLocalEvent<InventoryComponent, RefreshEquipmentHudEvent<ShowCriminalRecordIconsComponent>>(RelayInventoryEvent);
|
||||
|
||||
SubscribeLocalEvent<InventoryComponent, GetVerbsEvent<EquipmentVerb>>(OnGetEquipmentVerbs);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Rejuvenate;
|
||||
using Content.Shared.StatusIcon;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Nutrition.EntitySystems;
|
||||
|
||||
public sealed class HungerSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly AlertsSystem _alerts = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageable = default!;
|
||||
@@ -19,10 +24,27 @@ public sealed class HungerSystem : EntitySystem
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!;
|
||||
[Dependency] private readonly SharedJetpackSystem _jetpack = default!;
|
||||
|
||||
[ValidatePrototypeId<StatusIconPrototype>]
|
||||
private const string HungerIconOverfedId = "HungerIconOverfed";
|
||||
|
||||
[ValidatePrototypeId<StatusIconPrototype>]
|
||||
private const string HungerIconPeckishId = "HungerIconPeckish";
|
||||
|
||||
[ValidatePrototypeId<StatusIconPrototype>]
|
||||
private const string HungerIconStarvingId = "HungerIconStarving";
|
||||
|
||||
private StatusIconPrototype? _hungerIconOverfed;
|
||||
private StatusIconPrototype? _hungerIconPeckish;
|
||||
private StatusIconPrototype? _hungerIconStarving;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
DebugTools.Assert(_prototype.TryIndex(HungerIconOverfedId, out _hungerIconOverfed) &&
|
||||
_prototype.TryIndex(HungerIconPeckishId, out _hungerIconPeckish) &&
|
||||
_prototype.TryIndex(HungerIconStarvingId, out _hungerIconStarving));
|
||||
|
||||
SubscribeLocalEvent<HungerComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<HungerComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<HungerComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
|
||||
@@ -194,6 +216,27 @@ public sealed class HungerSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetStatusIconPrototype(HungerComponent component, [NotNullWhen(true)] out StatusIconPrototype? prototype)
|
||||
{
|
||||
switch (component.CurrentThreshold)
|
||||
{
|
||||
case HungerThreshold.Overfed:
|
||||
prototype = _hungerIconOverfed;
|
||||
break;
|
||||
case HungerThreshold.Peckish:
|
||||
prototype = _hungerIconPeckish;
|
||||
break;
|
||||
case HungerThreshold.Starving:
|
||||
prototype = _hungerIconStarving;
|
||||
break;
|
||||
default:
|
||||
prototype = null;
|
||||
break;
|
||||
}
|
||||
|
||||
return prototype != null;
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
@@ -3,9 +3,12 @@ using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Rejuvenate;
|
||||
using Content.Shared.StatusIcon;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Nutrition.EntitySystems;
|
||||
|
||||
@@ -13,15 +16,33 @@ namespace Content.Shared.Nutrition.EntitySystems;
|
||||
public sealed class ThirstSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly AlertsSystem _alerts = default!;
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
|
||||
[Dependency] private readonly SharedJetpackSystem _jetpack = default!;
|
||||
|
||||
[ValidatePrototypeId<StatusIconPrototype>]
|
||||
private const string ThirstIconOverhydratedId = "ThirstIconOverhydrated";
|
||||
|
||||
[ValidatePrototypeId<StatusIconPrototype>]
|
||||
private const string ThirstIconThirstyId = "ThirstIconThirsty";
|
||||
|
||||
[ValidatePrototypeId<StatusIconPrototype>]
|
||||
private const string ThirstIconParchedId = "ThirstIconParched";
|
||||
|
||||
private StatusIconPrototype? _thirstIconOverhydrated = null;
|
||||
private StatusIconPrototype? _thirstIconThirsty = null;
|
||||
private StatusIconPrototype? _thirstIconParched = null;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
DebugTools.Assert(_prototype.TryIndex(ThirstIconOverhydratedId, out _thirstIconOverhydrated) &&
|
||||
_prototype.TryIndex(ThirstIconThirstyId, out _thirstIconThirsty) &&
|
||||
_prototype.TryIndex(ThirstIconParchedId, out _thirstIconParched));
|
||||
|
||||
SubscribeLocalEvent<ThirstComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
|
||||
SubscribeLocalEvent<ThirstComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<ThirstComponent, RejuvenateEvent>(OnRejuvenate);
|
||||
@@ -107,6 +128,28 @@ public sealed class ThirstSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetStatusIconPrototype(ThirstComponent component, out StatusIconPrototype? prototype)
|
||||
{
|
||||
switch (component.CurrentThirstThreshold)
|
||||
{
|
||||
case ThirstThreshold.OverHydrated:
|
||||
prototype = _thirstIconOverhydrated;
|
||||
return true;
|
||||
|
||||
case ThirstThreshold.Thirsty:
|
||||
prototype = _thirstIconThirsty;
|
||||
return true;
|
||||
|
||||
case ThirstThreshold.Parched:
|
||||
prototype = _thirstIconParched;
|
||||
return true;
|
||||
|
||||
default:
|
||||
prototype = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateEffects(EntityUid uid, ThirstComponent component)
|
||||
{
|
||||
if (IsMovementThreshold(component.LastThirstThreshold) != IsMovementThreshold(component.CurrentThirstThreshold) &&
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Overlays;
|
||||
|
||||
/// <summary>
|
||||
/// This component allows you to see criminal record status of mobs.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class ShowCriminalRecordIconsComponent : Component { }
|
||||
@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
|
||||
namespace Content.Shared.Overlays;
|
||||
|
||||
/// <summary>
|
||||
/// This component allows you to see the hungriness of mobs.
|
||||
/// This component allows you to see the hungriness of mobs.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class ShowHungerIconsComponent : Component { }
|
||||
|
||||
@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
|
||||
namespace Content.Shared.Overlays;
|
||||
|
||||
/// <summary>
|
||||
/// This component allows you to see job icons above mobs.
|
||||
/// This component allows you to see job icons above mobs.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class ShowSecurityIconsComponent : Component { }
|
||||
public sealed partial class ShowJobIconsComponent : Component { }
|
||||
9
Content.Shared/Overlays/ShowMindShieldIconsComponent.cs
Normal file
9
Content.Shared/Overlays/ShowMindShieldIconsComponent.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Overlays;
|
||||
|
||||
/// <summary>
|
||||
/// This component allows you to see mindshield icons above mobs.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class ShowMindShieldIconsComponent : Component { }
|
||||
@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
|
||||
namespace Content.Shared.Overlays;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// This component allows you to identify members of the Syndicate faction.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class ShowSyndicateIconsComponent : Component {}
|
||||
|
||||
@@ -3,7 +3,7 @@ using Robust.Shared.GameStates;
|
||||
namespace Content.Shared.Overlays;
|
||||
|
||||
/// <summary>
|
||||
/// This component allows you to see the thirstiness of mobs.
|
||||
/// This component allows you to see the thirstiness of mobs.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class ShowThirstIconsComponent : Component { }
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
- WhitelistChameleon
|
||||
|
||||
- type: entity
|
||||
parent: ClothingEyesBase
|
||||
parent: [ClothingEyesBase, ShowSecurityIcons]
|
||||
id: ClothingEyesGlassesSecurity
|
||||
name: security glasses
|
||||
description: Upgraded sunglasses that provide flash immunity and a security HUD.
|
||||
@@ -178,7 +178,6 @@
|
||||
- type: GuideHelp
|
||||
guides:
|
||||
- Security
|
||||
- type: ShowSecurityIcons
|
||||
- type: IdentityBlocker
|
||||
coverage: EYES
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
- type: entity
|
||||
id: ShowSecurityIcons
|
||||
abstract: true
|
||||
noSpawn: true
|
||||
components:
|
||||
- type: ShowJobIcons
|
||||
- type: ShowMindShieldIcons
|
||||
- type: ShowCriminalRecordIcons
|
||||
|
||||
|
||||
- type: entity
|
||||
parent: ClothingEyesBase
|
||||
id: ClothingEyesHudDiagnostic
|
||||
@@ -17,7 +27,7 @@
|
||||
parent: ClothingEyesBase
|
||||
id: ClothingEyesHudMedical
|
||||
name: medical hud
|
||||
description: A heads-up display that scans the humanoids in view and provides accurate data about their health status.
|
||||
description: A heads-up display that scans the humanoids in view and provides accurate data about their health status.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Clothing/Eyes/Hud/med.rsi
|
||||
@@ -34,7 +44,7 @@
|
||||
- HudMedical
|
||||
|
||||
- type: entity
|
||||
parent: ClothingEyesBase
|
||||
parent: [ClothingEyesBase, ShowSecurityIcons]
|
||||
id: ClothingEyesHudSecurity
|
||||
name: security hud
|
||||
description: A heads-up display that scans the humanoids in view and provides accurate data about their ID status and security records.
|
||||
@@ -43,7 +53,6 @@
|
||||
sprite: Clothing/Eyes/Hud/sec.rsi
|
||||
- type: Clothing
|
||||
sprite: Clothing/Eyes/Hud/sec.rsi
|
||||
- type: ShowSecurityIcons
|
||||
- type: Tag
|
||||
tags:
|
||||
- HudSecurity
|
||||
@@ -138,7 +147,7 @@
|
||||
- type: ShowThirstIcons
|
||||
|
||||
- type: entity
|
||||
parent: ClothingEyesBase
|
||||
parent: [ClothingEyesBase, ShowSecurityIcons]
|
||||
id: ClothingEyesHudMedSec
|
||||
name: medsec hud
|
||||
description: An eye display that looks like a mixture of medical and security huds.
|
||||
@@ -150,13 +159,12 @@
|
||||
- type: Construction
|
||||
graph: HudMedSec
|
||||
node: medsecHud
|
||||
- type: ShowSecurityIcons
|
||||
- type: ShowHealthBars
|
||||
damageContainers:
|
||||
- Biological
|
||||
|
||||
- type: entity
|
||||
parent: ClothingEyesBase
|
||||
parent: [ClothingEyesBase, ShowSecurityIcons]
|
||||
id: ClothingEyesHudMultiversal
|
||||
name: multiversal hud
|
||||
description: Filler
|
||||
@@ -165,7 +173,6 @@
|
||||
sprite: Clothing/Eyes/Hud/medsecengi.rsi
|
||||
- type: Clothing
|
||||
sprite: Clothing/Eyes/Hud/medsecengi.rsi
|
||||
- type: ShowSecurityIcons
|
||||
- type: ShowHealthBars
|
||||
damageContainers:
|
||||
- Biological
|
||||
@@ -176,7 +183,7 @@
|
||||
- type: ShowSyndicateIcons
|
||||
|
||||
- type: entity
|
||||
parent: ClothingEyesBase
|
||||
parent: [ClothingEyesBase, ShowSecurityIcons]
|
||||
id: ClothingEyesHudOmni
|
||||
name: omni hud
|
||||
description: Filler
|
||||
@@ -185,7 +192,6 @@
|
||||
sprite: Clothing/Eyes/Hud/omni.rsi
|
||||
- type: Clothing
|
||||
sprite: Clothing/Eyes/Hud/omni.rsi
|
||||
- type: ShowSecurityIcons
|
||||
- type: ShowHealthBars
|
||||
damageContainers:
|
||||
- Biological
|
||||
@@ -198,7 +204,7 @@
|
||||
- type: ShowSyndicateIcons
|
||||
|
||||
- type: entity
|
||||
parent: ClothingEyesBase
|
||||
parent: [ClothingEyesBase, ShowSecurityIcons]
|
||||
id: ClothingEyesHudSyndicate
|
||||
name: syndicate visor
|
||||
description: The syndicate's professional head-up display, designed for better detection of humanoids and their subsequent elimination.
|
||||
@@ -208,7 +214,6 @@
|
||||
- type: Clothing
|
||||
sprite: Clothing/Eyes/Hud/synd.rsi
|
||||
- type: ShowSyndicateIcons
|
||||
- type: ShowSecurityIcons
|
||||
|
||||
- type: entity
|
||||
parent: ClothingEyesBase
|
||||
@@ -227,11 +232,9 @@
|
||||
- Biological
|
||||
|
||||
- type: entity
|
||||
parent: ClothingEyesGlassesSunglasses
|
||||
parent: [ClothingEyesGlassesSunglasses, ShowSecurityIcons]
|
||||
id: ClothingEyesGlassesHiddenSecurity
|
||||
suffix: Syndicate
|
||||
components:
|
||||
- type: ShowSecurityIcons
|
||||
|
||||
- type: entity
|
||||
parent: ClothingEyesHudMedical
|
||||
|
||||
@@ -227,7 +227,8 @@
|
||||
- AllAccess
|
||||
- type: AccessReader
|
||||
access: [["Command"], ["Research"]]
|
||||
- type: ShowSecurityIcons
|
||||
- type: ShowJobIcons
|
||||
- type: ShowMindShieldIcons
|
||||
|
||||
- type: entity
|
||||
id: BaseBorgChassisSyndicate
|
||||
|
||||
Reference in New Issue
Block a user