From 312dc3eb84ec58ea440420e4264baebd65b4d25c Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sun, 6 Apr 2025 04:01:26 +0700 Subject: [PATCH] Fix defuse behavior when bomb explodes - Ensure DefuseBombEnd is called when defusing and bomb explodes to properly stop defuse - Fixes the issue where defuse progress bar continued draw after bomb explosion --- regamedll/dlls/ggrenade.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/regamedll/dlls/ggrenade.cpp b/regamedll/dlls/ggrenade.cpp index 41e92f27..87835565 100644 --- a/regamedll/dlls/ggrenade.cpp +++ b/regamedll/dlls/ggrenade.cpp @@ -1170,6 +1170,12 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy if (!m_bIsC4) return; +#ifdef REGAMEDLL_FIXES + // block the start of defuse if the bomb timer has expired + if (m_flC4Blow > 0 && gpGlobals->time >= m_flC4Blow) + return; +#endif + // TODO: We must be sure that the activator is a player. CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pActivator->pev); @@ -1503,6 +1509,13 @@ void CGrenade::C4Think() { DefuseBombEnd(pPlayer, false); } +#ifdef REGAMEDLL_FIXES + // if the bomb timer has expired and defuse is still ongoing, stop the defuse + else if (gpGlobals->time >= m_flC4Blow) + { + DefuseBombEnd(pPlayer, false); + } +#endif } else {