Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Обычные госты больше не видят иконки фракций #1072

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Content.Client/StatusIcon/StatusIconSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using Content.Shared.StatusIcon.Components;
using Content.Shared.Stealth.Components;
using Content.Shared.Whitelist;
using Content.Shared.Administration.Managers; // Sunrise-Edit
using Content.Shared.Administration; // Sunrise-Edit
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Configuration;
Expand All @@ -19,6 +21,7 @@ public sealed class StatusIconSystem : SharedStatusIconSystem
[Dependency] private readonly IOverlayManager _overlay = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly EntityWhitelistSystem _entityWhitelist = default!;
[Dependency] private readonly ISharedAdminManager _adminManager = default!; // Sunrise-Edit

private bool _globalEnabled;
private bool _localEnabled;
Expand Down Expand Up @@ -71,13 +74,19 @@ public List<StatusIconData> GetStatusIcons(EntityUid uid, MetaDataComponent? met
public bool IsVisible(Entity<MetaDataComponent> ent, StatusIconData data)
{
var viewer = _playerManager.LocalSession?.AttachedEntity;
// Sunrise-Edit-Start
if (viewer == null)
return false;
// Sunrise-Edit-End

// Always show our icons to our entity
if (viewer == ent.Owner)
return true;

if (data.VisibleToGhosts && HasComp<GhostComponent>(viewer))
// Sunrise-Edit-Start
if (data is FactionIconPrototype && HasComp<GhostComponent>(viewer) && _adminManager.HasAdminFlag(viewer.Value, AdminFlags.Admin))
return true;
// Sunrise-Edit-End

if (data.HideInContainer && (ent.Comp.Flags & MetaDataFlags.InContainer) != 0)
return false;
Expand All @@ -88,6 +97,10 @@ public bool IsVisible(Entity<MetaDataComponent> ent, StatusIconData data)
if (data.ShowTo != null && !_entityWhitelist.IsValid(data.ShowTo, viewer))
return false;

// Sunrise-Edit-Start
if (HasComp<GhostComponent>(viewer))
return data.VisibleToGhosts;
// Sunrise-Edit-End
return true;
}
}
Loading