This commit is contained in:
Braindawg 2025-04-01 02:39:15 +02:00 committed by GitHub
commit 8a75304f6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 2 deletions

View file

@ -186,6 +186,9 @@ bool VScriptClientInit()
g_pScriptVM->Run( g_Script_vscript_client );
}
// ignore map-packed serverspawn files, allows server owners to run scripts before the map
VScriptRunScript( "serverspawn", false );
VScriptRunScript( "mapspawn", false );
VMPROF_SHOW( pszScriptLanguage, "virtual machine startup" );

View file

@ -3503,6 +3503,9 @@ REGISTER_SCRIPT_CONST_TABLE( Server )
}
g_VScriptGameEventListener.Init();
// ignore map-packed serverspawn files, allows server owners to run scripts before the map
VScriptRunScript( "serverspawn", false );
VScriptRunScript( "mapspawn", false );
if ( script_connect_debugger_on_mapspawn.GetBool() )

View file

@ -1,4 +1,4 @@
//========== Copyright © 2008, Valve Corporation, All rights reserved. ========
//========== Copyright <EFBFBD> 2008, Valve Corporation, All rights reserved. ========
//
// Purpose:
//
@ -102,7 +102,17 @@ HSCRIPT VScriptCompileScript( const char *pszScriptName, bool bWarnMissing )
}
else
{
bool bResult = filesystem->ReadFile( scriptPath, "GAME", bufferScript );
bool bResult = false;
// ignore map-packed serverspawn files, allows server owners to run scripts before the map
if ( V_strcmp( pszScriptName, "serverspawn" ) == 0 || V_strcmp( pszScriptName, CFmtStr( "serverspawn%s", pszVMExtension ) ) == 0 )
{
bResult = filesystem->ReadFile( scriptPath, "MOD", bufferScript );
}
else
{
bResult = filesystem->ReadFile( scriptPath, "GAME", bufferScript );
}
if( !bResult )
{