using Content.Shared.Antag;
using Content.Shared.Revolutionary.Components;
using Content.Shared.Ghost;
using Content.Shared.StatusIcon.Components;
namespace Content.Client.Revolutionary;
///
/// Used for the client to get status icons from other revs.
///
public sealed class RevolutionarySystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent(OnCanShowRevIcon);
SubscribeLocalEvent(OnCanShowRevIcon);
}
///
/// Determine whether a client should display the rev icon.
///
private void OnCanShowRevIcon(EntityUid uid, T comp, ref CanDisplayStatusIconsEvent args) where T : IAntagStatusIconComponent
{
args.Cancelled = !CanDisplayIcon(args.User, comp.IconVisibleToGhost);
}
///
/// The criteria that determine whether a client should see Rev/Head rev icons.
///
private bool CanDisplayIcon(EntityUid? uid, bool visibleToGhost)
{
if (HasComp(uid) || HasComp(uid))
return true;
if (visibleToGhost && HasComp(uid))
return true;
return HasComp(uid);
}
}