@@ -515,27 +515,21 @@ local function CustomChat_HUDShouldDraw( name )
515
515
if name == " CHudChat" then return false end
516
516
end
517
517
518
- local isGamePaused = false
519
-
520
518
local function CustomChat_Think ()
521
519
if not CustomChat .frame then return end
522
520
523
- -- Hide the chat box if the game is paused
524
- if gui . IsGameUIVisible () then
525
- if isGamePaused == false then
526
- isGamePaused = true
521
+ if not gui . IsGameUIVisible () and not CustomChat . frame : IsVisible () then
522
+ CustomChat . frame : SetVisible ( true )
523
+ end
524
+ end
527
525
528
- CustomChat .frame :SetVisible ( false )
526
+ local function CustomChat_OnPauseMenuShow ()
527
+ if not CustomChat .frame then return end
529
528
530
- if CustomChat .frame .isChatOpen then
531
- chat .Close ()
532
- end
533
- end
534
- else
535
- if isGamePaused == true then
536
- isGamePaused = false
537
- CustomChat .frame :SetVisible ( true )
538
- end
529
+ if CustomChat .frame :IsVisible () then
530
+ CustomChat .frame :SetVisible ( false )
531
+
532
+ return false
539
533
end
540
534
end
541
535
@@ -548,6 +542,7 @@ function CustomChat:Enable()
548
542
hook .Add ( " PlayerBindPress" , " CustomChat.OnPlayerBindPress" , CustomChat_OnPlayerBindPress )
549
543
hook .Add ( " HUDShouldDraw" , " CustomChat.HUDShouldDraw" , CustomChat_HUDShouldDraw )
550
544
hook .Add ( " Think" , " CustomChat.Think" , CustomChat_Think )
545
+ hook .Add ( " OnPauseMenuShow" , " CustomChat.OnPauseMenuShow" , CustomChat_OnPauseMenuShow )
551
546
552
547
if IsValid ( CustomChat .frame ) then
553
548
CustomChat .frame :SetVisible ( true )
@@ -567,6 +562,7 @@ function CustomChat:Disable()
567
562
hook .Remove ( " PlayerBindPress" , " CustomChat.OnPlayerBindPress" )
568
563
hook .Remove ( " HUDShouldDraw" , " CustomChat.HUDShouldDraw" )
569
564
hook .Remove ( " Think" , " CustomChat.Think" )
565
+ hook .Remove ( " OnPauseMenuShow" , " CustomChat.OnPauseMenuShow" )
570
566
571
567
chat .AddText = CustomChat .DefaultAddText
572
568
chat .Close = CustomChat .DefaultClose
0 commit comments