mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-26 06:45:31 +03:00
Fix vscript global hook calls
This commit is contained in:
parent
4af6d0cdaa
commit
f2f874939d
@ -215,16 +215,17 @@ Hooks <-
|
||||
|
||||
function Call( scope, event, ... )
|
||||
{
|
||||
local firstReturn = null
|
||||
local firstReturn
|
||||
|
||||
if ( scope == null )
|
||||
// global hook; call all scopes
|
||||
if ( !scope )
|
||||
{
|
||||
// null scope = global hook; call all scopes
|
||||
vargv.insert(0,this)
|
||||
foreach ( t in s_List )
|
||||
vargv.insert( 0, null )
|
||||
foreach( sc,t in s_List )
|
||||
{
|
||||
if ( event in t )
|
||||
{
|
||||
vargv[0] = sc
|
||||
foreach( context, callback in t[event] )
|
||||
{
|
||||
//printf( "(%.4f) Calling hook '%s' of context '%s' in static iteration\n", Time(), event, context )
|
||||
@ -241,7 +242,7 @@ Hooks <-
|
||||
local t = s_List[scope]
|
||||
if ( event in t )
|
||||
{
|
||||
vargv.insert(0,scope)
|
||||
vargv.insert( 0, scope )
|
||||
foreach( context, callback in t[event] )
|
||||
{
|
||||
//printf( "(%.4f) Calling hook '%s' of context '%s'\n", Time(), event, context )
|
||||
@ -258,13 +259,7 @@ Hooks <-
|
||||
|
||||
function ScopeHookedToEvent( scope, event )
|
||||
{
|
||||
if ( scope in s_List )
|
||||
{
|
||||
if (event in s_List[scope])
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return ( scope in s_List ) && ( event in s_List[scope] )
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user