Skip to content

Commit bc2bee4

Browse files
committed
Don't rely on visibility to block the pause menu
1 parent 7d40658 commit bc2bee4

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

lua/custom_chat/client/main.lua

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ local function CustomChat_Open( pcalled )
453453
CustomChat.frame:SetKeyboardInputEnabled( true )
454454
CustomChat.frame:OpenChat()
455455

456+
CustomChat.isOpen = true
456457
CustomChat.SetTyping( true )
457458

458459
-- Make sure the gamemode and other addons know we are chatting
@@ -465,6 +466,8 @@ local function CustomChat_Close()
465466
CustomChat.frame:CloseChat()
466467
CustomChat.frame:SetMouseInputEnabled( false )
467468
CustomChat.frame:SetKeyboardInputEnabled( false )
469+
470+
CustomChat.isOpen = false
468471
CustomChat.SetTyping( false )
469472

470473
gui.EnableScreenClicker( false )
@@ -516,18 +519,26 @@ local function CustomChat_HUDShouldDraw( name )
516519
end
517520

518521
local function CustomChat_Think()
519-
if not CustomChat.frame then return end
522+
local frame = CustomChat.frame
523+
if not frame then return end
520524

521-
if not gui.IsGameUIVisible() and not CustomChat.frame:IsVisible() then
522-
CustomChat.frame:SetVisible( true )
525+
if gui.IsGameUIVisible() then
526+
if frame:IsVisible() then
527+
-- Close and completely hide the chat
528+
-- while the pause menu is visible
529+
chat.Close()
530+
frame:SetVisible( false )
531+
end
532+
533+
elseif not frame:IsVisible() then
534+
-- Make the chat visible otherwise
535+
frame:SetVisible( true )
523536
end
524537
end
525538

526539
local function CustomChat_OnPauseMenuShow()
527-
if not CustomChat.frame then return end
528-
529-
if CustomChat.frame:IsVisible() then
530-
CustomChat.frame:SetVisible( false )
540+
if CustomChat.frame and CustomChat.isOpen then
541+
chat.Close()
531542

532543
return false
533544
end

0 commit comments

Comments
 (0)