From acba3c6ed4263933f2e77b376be0839f0ce78258 Mon Sep 17 00:00:00 2001 From: Pierce Date: Wed, 29 Dec 2021 23:20:10 -0500 Subject: [PATCH] call hook for to prevent dc interface from showing --- lua/cfc_disconnect_interface/client/cl_interface.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lua/cfc_disconnect_interface/client/cl_interface.lua b/lua/cfc_disconnect_interface/client/cl_interface.lua index ecd2475..777c141 100644 --- a/lua/cfc_disconnect_interface/client/cl_interface.lua +++ b/lua/cfc_disconnect_interface/client/cl_interface.lua @@ -457,21 +457,13 @@ local function createInterface() 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 ) timeDown = _timeDown if _apiState ~= CFCCrashAPI.PINGING_API then apiState = _apiState end - - if isCrashing and not isShuttingDownManually then + local shouldShowInterface = hook.Run("CFC_DisconnectInterface_ShouldShowInterface") + 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 if _apiState == CFCCrashAPI.PINGING_API or _apiState == CFCCrashAPI.SERVER_UP then return end if interfaceDerma or previouslyShown then return end