Made VBSP's OnMapLoaded into a hook using the new system

This commit is contained in:
Blixibon
2021-11-07 07:35:28 -06:00
parent 653d48d2c4
commit b2116d07e9
3 changed files with 11 additions and 4 deletions

View File

@@ -2806,14 +2806,12 @@ bool LoadMapFile( const char *pszFileName )
#ifdef MAPBASE_VSCRIPT
if ( g_pScriptVM )
{
HSCRIPT hFunc = g_pScriptVM->LookupFunction( "OnMapLoaded" );
if ( hFunc )
if (CMapFile::g_Hook_OnMapLoaded.CanRunInScope( NULL ))
{
// Use GetLoadingMap()
//g_pScriptVM->SetValue( "map", g_LoadingMap->GetScriptInstance() );
g_pScriptVM->Call( hFunc );
g_pScriptVM->ReleaseFunction( hFunc );
CMapFile::g_Hook_OnMapLoaded.Call( NULL, NULL, NULL );
//g_pScriptVM->ClearValue( "map" );
}