Don't force bwoink window open for admins (#8066)

This commit is contained in:
metalgearsloth
2022-05-13 09:45:08 +10:00
committed by GitHub
parent d82f9155eb
commit 91bb48eec9
3 changed files with 26 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ using System.Linq;
using Content.Client.Administration.Managers;
using Content.Client.Administration.UI;
using Content.Client.Administration.UI.CustomControls;
using Content.Client.HUD;
using Content.Shared.Administration;
using JetBrains.Annotations;
using Robust.Client.Graphics;
@@ -25,6 +26,7 @@ namespace Content.Client.Administration
[Dependency] private readonly IClientAdminManager _adminManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IClyde _clyde = default!;
[Dependency] private readonly IGameHud _hud = default!;
private BwoinkWindow? _adminWindow;
private DefaultWindow? _plainWindow;
@@ -47,7 +49,17 @@ namespace Content.Client.Administration
_clyde.RequestWindowAttention();
}
_adminWindow?.OnBwoink(message.ChannelId);
// If they're not an admin force it open so they read
// If it's admin-admin messaging then eh.
if (!_adminManager.HasFlag(AdminFlags.Adminhelp))
_plainWindow?.Open();
else
{
_adminWindow?.OnBwoink(message.ChannelId);
if (_adminWindow?.IsOpen != true)
_hud.SetInfoRed(true);
}
}
public bool TryGetChannel(NetUserId ch, [NotNullWhen(true)] out BwoinkPanel? bp) => _activePanelMap.TryGetValue(ch, out bp);
@@ -64,8 +76,6 @@ namespace Content.Client.Administration
_adminWindow.BwoinkArea.AddChild(existingPanel);
}
if(!_adminWindow.IsOpen) _adminWindow.Open();
return existingPanel;
}
@@ -90,7 +100,6 @@ namespace Content.Client.Administration
bp = (BwoinkPanel) _plainWindow.Contents.GetChild(0);
}
_plainWindow.Open();
return bp;
}
@@ -112,13 +121,17 @@ namespace Content.Client.Administration
return;
}
_hud.SetInfoRed(false);
if (_adminManager.HasFlag(AdminFlags.Adminhelp))
{
SelectChannel(channelId.Value);
_adminWindow?.Open();
return;
}
EnsurePlain(channelId.Value);
_plainWindow?.Open();
}
public void Close()