Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Adds and uses bool member HasStealthComponent to GetStatusIconsEvent
Browse files Browse the repository at this point in the history
This makes stealth effective against all huds
  • Loading branch information
rbertoche committed Nov 12, 2023
1 parent 0c7f6b9 commit 83c53ab
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Overlays/ShowHealthIconsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected override void DeactivateInternal()

private void OnGetStatusIconsEvent(EntityUid uid, DamageableComponent damageableComponent, ref GetStatusIconsEvent args)
{
if (!IsActive || args.InContainer)
if (!IsActive || args.InContainer || args.HasStealthComponent)
return;

AppendHealthIcons(damageableComponent, args.StatusIcons);
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Overlays/ShowHungerIconsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override void Initialize()

private void OnGetStatusIconsEvent(EntityUid uid, HungerComponent hungerComponent, ref GetStatusIconsEvent args)
{
if (!IsActive || args.InContainer)
if (!IsActive || args.InContainer || args.HasStealthComponent)
return;

var healthIcons = DecideHungerIcon(uid, hungerComponent);
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Overlays/ShowSecurityIconsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override void Initialize()

private void OnGetStatusIconsEvent(EntityUid uid, StatusIconComponent _, ref GetStatusIconsEvent @event)
{
if (!IsActive || @event.InContainer)
if (!IsActive || @event.InContainer || @event.HasStealthComponent)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Overlays/ShowThirstIconsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override void Initialize()

private void OnGetStatusIconsEvent(EntityUid uid, ThirstComponent thirstComponent, ref GetStatusIconsEvent args)
{
if (!IsActive || args.InContainer)
if (!IsActive || args.InContainer || args.HasStealthComponent)
return;

var healthIcons = DecideThirstIcon(uid, thirstComponent);
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/SSDIndicator/SSDIndicatorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ private void OnGetStatusIcon(EntityUid uid, SSDIndicatorComponent component, ref
{
if (!component.IsSSD ||
!_cfg.GetCVar(CCVars.ICShowSSDIndicator) ||
args.InContainer)
args.InContainer ||
args.HasStealthComponent)
return;

args.StatusIcons.Add(_prototype.Index<StatusIconPrototype>(component.Icon));
Expand Down
5 changes: 4 additions & 1 deletion Content.Client/StatusIcon/StatusIconSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Shared.CCVar;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Content.Shared.Stealth.Components;
using Robust.Client.Graphics;
using Robust.Shared.Configuration;

Expand All @@ -13,6 +14,7 @@ public sealed class StatusIconSystem : SharedStatusIconSystem
{
[Dependency] private readonly IConfigurationManager _configuration = default!;
[Dependency] private readonly IOverlayManager _overlay = default!;
[Dependency] private readonly IEntityManager _entManager = default!;

private bool _globalEnabled;
private bool _localEnabled;
Expand Down Expand Up @@ -63,7 +65,8 @@ public List<StatusIconData> GetStatusIcons(EntityUid uid, MetaDataComponent? met
return list;

var inContainer = (meta.Flags & MetaDataFlags.InContainer) != 0;
var ev = new GetStatusIconsEvent(list, inContainer);
var hasStealthComponent = _entManager.HasComponent<StealthComponent>(uid);
var ev = new GetStatusIconsEvent(list, inContainer, hasStealthComponent);
RaiseLocalEvent(uid, ref ev);
return ev.StatusIcons;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ public sealed partial class StatusIconComponent : Component
/// </summary>
/// <param name="StatusIcons"></param>
[ByRefEvent]
public record struct GetStatusIconsEvent(List<StatusIconData> StatusIcons, bool InContainer);
public record struct GetStatusIconsEvent(List<StatusIconData> StatusIcons, bool InContainer, bool HasStealthComponent);

0 comments on commit 83c53ab

Please sign in to comment.