Only show local/radio/emote channels when in-game (#5566)
This commit is contained in:
@@ -4,12 +4,14 @@ using System.Linq;
|
|||||||
using Content.Client.Administration.Managers;
|
using Content.Client.Administration.Managers;
|
||||||
using Content.Client.Chat.UI;
|
using Content.Client.Chat.UI;
|
||||||
using Content.Client.Ghost;
|
using Content.Client.Ghost;
|
||||||
|
using Content.Client.Viewport;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Chat;
|
using Content.Shared.Chat;
|
||||||
using Robust.Client.Console;
|
using Robust.Client.Console;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Client.State;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
@@ -94,6 +96,7 @@ namespace Content.Client.Chat.Managers
|
|||||||
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
||||||
[Dependency] private readonly IClientAdminManager _adminMgr = default!;
|
[Dependency] private readonly IClientAdminManager _adminMgr = default!;
|
||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
|
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current chat box control. This can be modified, so do not depend on saving a reference to this.
|
/// Current chat box control. This can be modified, so do not depend on saving a reference to this.
|
||||||
@@ -133,6 +136,7 @@ namespace Content.Client.Chat.Managers
|
|||||||
LayoutContainer.SetAnchorPreset(_speechBubbleRoot, LayoutContainer.LayoutPreset.Wide);
|
LayoutContainer.SetAnchorPreset(_speechBubbleRoot, LayoutContainer.LayoutPreset.Wide);
|
||||||
_userInterfaceManager.StateRoot.AddChild(_speechBubbleRoot);
|
_userInterfaceManager.StateRoot.AddChild(_speechBubbleRoot);
|
||||||
_speechBubbleRoot.SetPositionFirst();
|
_speechBubbleRoot.SetPositionFirst();
|
||||||
|
_stateManager.OnStateChanged += _ => UpdateChannelPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInject()
|
public void PostInject()
|
||||||
@@ -188,19 +192,21 @@ namespace Content.Client.Chat.Managers
|
|||||||
// can always hear server (nobody can actually send server messages).
|
// can always hear server (nobody can actually send server messages).
|
||||||
FilterableChannels |= ChatChannel.Server;
|
FilterableChannels |= ChatChannel.Server;
|
||||||
|
|
||||||
// can always hear local / radio / emote
|
if (_stateManager.CurrentState is GameScreenBase)
|
||||||
// todo: this makes no sense the lobby exists fix this.
|
|
||||||
FilterableChannels |= ChatChannel.Local;
|
|
||||||
FilterableChannels |= ChatChannel.Radio;
|
|
||||||
FilterableChannels |= ChatChannel.Emotes;
|
|
||||||
|
|
||||||
// Can only send local / radio / emote when attached to a non-ghost entity.
|
|
||||||
// TODO: this logic is iffy (checking if controlling something that's NOT a ghost), is there a better way to check this?
|
|
||||||
if (!IsGhost)
|
|
||||||
{
|
{
|
||||||
SelectableChannels |= ChatSelectChannel.Local;
|
// can always hear local / radio / emote when in the game
|
||||||
SelectableChannels |= ChatSelectChannel.Radio;
|
FilterableChannels |= ChatChannel.Local;
|
||||||
SelectableChannels |= ChatSelectChannel.Emotes;
|
FilterableChannels |= ChatChannel.Radio;
|
||||||
|
FilterableChannels |= ChatChannel.Emotes;
|
||||||
|
|
||||||
|
// Can only send local / radio / emote when attached to a non-ghost entity.
|
||||||
|
// TODO: this logic is iffy (checking if controlling something that's NOT a ghost), is there a better way to check this?
|
||||||
|
if (!IsGhost)
|
||||||
|
{
|
||||||
|
SelectableChannels |= ChatSelectChannel.Local;
|
||||||
|
SelectableChannels |= ChatSelectChannel.Radio;
|
||||||
|
SelectableChannels |= ChatSelectChannel.Emotes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only ghosts and admins can send / see deadchat.
|
// Only ghosts and admins can send / see deadchat.
|
||||||
|
|||||||
Reference in New Issue
Block a user