Fix Glorfcode (#22271)

This commit is contained in:
KP
2023-12-11 00:53:10 -08:00
committed by GitHub
parent 342b08418e
commit 1b5e5032f4

View File

@@ -706,17 +706,14 @@ public sealed class ChatUIController : UIController
private void OnDamageForceSay(DamageForceSayEvent ev, EntitySessionEventArgs _) private void OnDamageForceSay(DamageForceSayEvent ev, EntitySessionEventArgs _)
{ {
if (UIManager.ActiveScreen?.GetWidget<ChatBox>() is not { } chatBox) var chatBox = UIManager.ActiveScreen?.GetWidget<ChatBox>() ?? UIManager.ActiveScreen?.GetWidget<ResizableChatBox>();
return;
// Don't send on OOC/LOOC obviously! // Don't send on OOC/LOOC obviously!
if (chatBox.SelectedChannel is not if (chatBox?.SelectedChannel is not (ChatSelectChannel.Local or
(ChatSelectChannel.Local or
ChatSelectChannel.Radio or ChatSelectChannel.Radio or
ChatSelectChannel.Whisper)) ChatSelectChannel.Whisper))
return; return;
if (_player.LocalPlayer?.ControlledEntity is not { } ent if (_player.LocalSession?.AttachedEntity is not { } ent
|| !EntityManager.TryGetComponent<DamageForceSayComponent>(ent, out var forceSay)) || !EntityManager.TryGetComponent<DamageForceSayComponent>(ent, out var forceSay))
return; return;