call hook for to prevent dc interface from showing

This commit is contained in:
Pierce 2021-12-29 23:20:10 -05:00 committed by plally
parent 863cc5d480
commit acba3c6ed4

View File

@ -457,21 +457,13 @@ local function createInterface()
end end
local isShuttingDownManually = false
hook.Add( "ShutDown", "CFC_DisconnectInterface_MarkShutdown", function()
isShuttingDownManually = true
if interfaceDerma then
interfaceDerma:Close()
end
end )
hook.Add( "CFC_CrashTick", "CFC_DisconnectInterface_InterfaceUpdate", function( isCrashing, _timeDown, _apiState ) hook.Add( "CFC_CrashTick", "CFC_DisconnectInterface_InterfaceUpdate", function( isCrashing, _timeDown, _apiState )
timeDown = _timeDown timeDown = _timeDown
if _apiState ~= CFCCrashAPI.PINGING_API then if _apiState ~= CFCCrashAPI.PINGING_API then
apiState = _apiState apiState = _apiState
end end
local shouldShowInterface = hook.Run("CFC_DisconnectInterface_ShouldShowInterface")
if isCrashing and not isShuttingDownManually then if shouldShowInterface ~= false and isCrashing and then
-- Open interface if server is crashing, API has responded, interface isn't already open, and interface has not yet been opened -- Open interface if server is crashing, API has responded, interface isn't already open, and interface has not yet been opened
if _apiState == CFCCrashAPI.PINGING_API or _apiState == CFCCrashAPI.SERVER_UP then return end if _apiState == CFCCrashAPI.PINGING_API or _apiState == CFCCrashAPI.SERVER_UP then return end
if interfaceDerma or previouslyShown then return end if interfaceDerma or previouslyShown then return end