mirror of
https://github.com/celisej567/BCWSsrc.git
synced 2026-09-15 20:12:39 +03:00
Added new features and customization to base VScript functionality
This commit is contained in:
@@ -61,6 +61,12 @@ void ParseScriptTableKeyValues( CBaseEntity *pEntity, HSCRIPT hKV )
|
||||
|
||||
void PrecacheEntityFromTable( const char *pszClassname, HSCRIPT hKV )
|
||||
{
|
||||
if ( IsEntityCreationAllowedInScripts() == false )
|
||||
{
|
||||
Warning( "VScript error: A script attempted to create an entity mid-game. Due to the server's settings, entity creation from scripts is only allowed during map init.\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// This is similar to UTIL_PrecacheOther(), but we can't check if we can only precache it once.
|
||||
// Probably for the best anyway, as similar classes can still have different precachable properties.
|
||||
CBaseEntity *pEntity = CreateEntityByName( pszClassname );
|
||||
@@ -79,6 +85,12 @@ void PrecacheEntityFromTable( const char *pszClassname, HSCRIPT hKV )
|
||||
|
||||
HSCRIPT SpawnEntityFromTable( const char *pszClassname, HSCRIPT hKV )
|
||||
{
|
||||
if ( IsEntityCreationAllowedInScripts() == false )
|
||||
{
|
||||
Warning( "VScript error: A script attempted to create an entity mid-game. Due to the server's settings, entity creation from scripts is only allowed during map init.\n" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CBaseEntity *pEntity = CreateEntityByName( pszClassname );
|
||||
if ( !pEntity )
|
||||
{
|
||||
@@ -108,6 +120,12 @@ inline CScriptKeyValues *ToScriptKeyValues( HSCRIPT hKV )
|
||||
|
||||
HSCRIPT SpawnEntityFromKeyValues( const char *pszClassname, HSCRIPT hKV )
|
||||
{
|
||||
if ( IsEntityCreationAllowedInScripts() == false )
|
||||
{
|
||||
Warning( "VScript error: A script attempted to create an entity mid-game. Due to the server's settings, entity creation from scripts is only allowed during map init.\n" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CBaseEntity *pEntity = CreateEntityByName( pszClassname );
|
||||
if ( !pEntity )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user