fish-station/Content.Client/Chat/CollectiveMindChatUpdateSystem.cs
Vigers Ray 3fc11027a9 ыыы
2025-02-19 00:12:10 +03:00

32 lines
1.1 KiB
C#

using Content.Client.Chat.Managers;
using Content.Shared._Sunrise.CollectiveMind;
using Robust.Client.Player;
namespace Content.Client.Chat
{
public sealed class CollectiveMindChatUpdateSystem : EntitySystem
{
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CollectiveMindComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<CollectiveMindComponent, ComponentRemove>(OnRemove);
}
public CollectiveMindComponent? Player => CompOrNull<CollectiveMindComponent>(_playerManager.LocalSession?.AttachedEntity);
public bool IsCollectiveMind => Player != null;
private void OnInit(EntityUid uid, CollectiveMindComponent component, ComponentInit args)
{
_chatManager.UpdatePermissions();
}
private void OnRemove(EntityUid uid, CollectiveMindComponent component, ComponentRemove args)
{
_chatManager.UpdatePermissions();
}
}
}