chat2: fix hide state being permanently overridden when faded out/paused

This commit is contained in:
astatine
2020-05-03 20:33:29 +02:00
committed by blattersturm
parent 872731b0ac
commit 99dac40452

View File

@@ -278,13 +278,17 @@ Citizen.CreateThread(function()
if chatLoaded then if chatLoaded then
local forceHide = IsScreenFadedOut() or IsPauseMenuActive() local forceHide = IsScreenFadedOut() or IsPauseMenuActive()
local wasForceHide = false
if forceHide then if chatHideState ~= CHAT_HIDE_STATES.ALWAYS_HIDE then
origChatHideState = chatHideState if forceHide then
chatHideState = CHAT_HIDE_STATES.ALWAYS_HIDE origChatHideState = chatHideState
elseif origChatHideState ~= -1 then chatHideState = CHAT_HIDE_STATES.ALWAYS_HIDE
end
elseif not forceHide and origChatHideState ~= -1 then
chatHideState = origChatHideState chatHideState = origChatHideState
origChatHideState = -1 origChatHideState = -1
wasForceHide = true
end end
if chatHideState ~= lastChatHideState then if chatHideState ~= lastChatHideState then
@@ -293,7 +297,7 @@ Citizen.CreateThread(function()
SendNUIMessage({ SendNUIMessage({
type = 'ON_SCREEN_STATE_CHANGE', type = 'ON_SCREEN_STATE_CHANGE',
hideState = chatHideState, hideState = chatHideState,
fromUserInteraction = not forceHide and not isFirstHide fromUserInteraction = not forceHide and not isFirstHide and not wasForceHide
}) })
isFirstHide = false isFirstHide = false