adminmenu fixes (#5305)
This commit is contained in:
@@ -1,14 +1,28 @@
|
|||||||
|
using Content.Client.Administration.Managers;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Client.Administration
|
namespace Content.Client.Administration
|
||||||
{
|
{
|
||||||
public partial class AdminSystem
|
public partial class AdminSystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IClientAdminManager _adminManager = default!;
|
||||||
private AdminNameOverlay _adminNameOverlay = default!;
|
private AdminNameOverlay _adminNameOverlay = default!;
|
||||||
|
|
||||||
private void InitializeOverlay()
|
private void InitializeOverlay()
|
||||||
{
|
{
|
||||||
_adminNameOverlay = new AdminNameOverlay(this, _entityManager, _eyeManager, _resourceCache, _entityLookup);
|
_adminNameOverlay = new AdminNameOverlay(this, _entityManager, _eyeManager, _resourceCache, _entityLookup);
|
||||||
|
_adminManager.AdminStatusUpdated += OnAdminStatusUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShutdownOverlay()
|
||||||
|
{
|
||||||
|
_adminManager.AdminStatusUpdated -= OnAdminStatusUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAdminStatusUpdated()
|
||||||
|
{
|
||||||
|
AdminOverlayOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AdminOverlayOn(BaseButton.ButtonEventArgs? _ = null)
|
public void AdminOverlayOn(BaseButton.ButtonEventArgs? _ = null)
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ namespace Content.Client.Administration
|
|||||||
SubscribeNetworkEvent<PlayerInfoRemovalMessage>(OnPlayerInfoRemoval);
|
SubscribeNetworkEvent<PlayerInfoRemovalMessage>(OnPlayerInfoRemoval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Shutdown()
|
||||||
|
{
|
||||||
|
base.Shutdown();
|
||||||
|
ShutdownOverlay();
|
||||||
|
}
|
||||||
|
|
||||||
private void OnPlayerInfoRemoval(PlayerInfoRemovalMessage ev)
|
private void OnPlayerInfoRemoval(PlayerInfoRemovalMessage ev)
|
||||||
{
|
{
|
||||||
if (_playerList == null) _playerList = new();
|
if (_playerList == null) _playerList = new();
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Administration.Managers;
|
using Content.Server.Administration.Managers;
|
||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
|
using Content.Server.Roles;
|
||||||
|
using Content.Server.Traitor;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Administration.Events;
|
using Content.Shared.Administration.Events;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -25,11 +27,28 @@ namespace Content.Server.Administration
|
|||||||
_adminManager.OnPermsChanged += OnAdminPermsChanged;
|
_adminManager.OnPermsChanged += OnAdminPermsChanged;
|
||||||
SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttached);
|
SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttached);
|
||||||
SubscribeLocalEvent<PlayerDetachedEvent>(OnPlayerDetached);
|
SubscribeLocalEvent<PlayerDetachedEvent>(OnPlayerDetached);
|
||||||
|
SubscribeLocalEvent<RoleAddedEvent>(OnRoleAddedEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnRoleAddedEvent(RoleAddedEvent ev)
|
||||||
|
{
|
||||||
|
if (ev.Role.Antagonist && ev.Role.Mind.Session != null)
|
||||||
|
{
|
||||||
|
foreach (var admin in _adminManager.ActiveAdmins)
|
||||||
|
{
|
||||||
|
RaiseNetworkEvent(GetChangedEvent(ev.Role.Mind.Session), admin.ConnectedClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAdminPermsChanged(AdminPermsChangedEventArgs obj)
|
private void OnAdminPermsChanged(AdminPermsChangedEventArgs obj)
|
||||||
{
|
{
|
||||||
if(!obj.IsAdmin) return;
|
if(!obj.IsAdmin)
|
||||||
|
{
|
||||||
|
RaiseNetworkEvent(new FullPlayerListEvent(), obj.Player.ConnectedClient);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SendFullPlayerList(obj.Player);
|
SendFullPlayerList(obj.Player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user