Merge pull request #279 from samisalreadytaken/fix-weapon_custom_scripted

weapon_custom_scripted fixes
This commit is contained in:
Blixibon 2024-02-04 15:27:32 -06:00 committed by GitHub
commit f8d8cf6d2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -180,7 +180,7 @@ bool CWeaponCustomScripted::RunWeaponHook( ScriptHook_t &hook, HSCRIPT &cached,
{ {
if ( !cached ) if ( !cached )
{ {
if ( hook.CanRunInScope( m_ScriptScope ) ) if ( m_ScriptScope.IsInitialized() && hook.CanRunInScope( m_ScriptScope ) )
{ {
cached = hook.m_hFunc; cached = hook.m_hFunc;
} }
@ -188,6 +188,7 @@ bool CWeaponCustomScripted::RunWeaponHook( ScriptHook_t &hook, HSCRIPT &cached,
if (cached) if (cached)
{ {
hook.m_hFunc = cached;
return hook.Call( m_ScriptScope, retVal, pArgs, false ); return hook.Call( m_ScriptScope, retVal, pArgs, false );
} }
@ -328,7 +329,7 @@ void CWeaponCustomScripted::ItemPreFrame( void )
{ {
SIMPLE_VOID_OVERRIDE( ItemPreFrame, NULL ); SIMPLE_VOID_OVERRIDE( ItemPreFrame, NULL );
BaseClass::ItemPostFrame(); BaseClass::ItemPreFrame();
} }
void CWeaponCustomScripted::ItemPostFrame( void ) void CWeaponCustomScripted::ItemPostFrame( void )