Added new features and customization to base VScript functionality

This commit is contained in:
Blixibon
2020-05-27 10:22:45 -05:00
parent 6ad2745a5e
commit c12418e1ce
11 changed files with 124 additions and 0 deletions

View File

@@ -18,6 +18,9 @@
#ifdef _WIN32
//#include "vscript_server_nut.h"
#endif
#ifdef MAPBASE_VSCRIPT
#include "world.h"
#endif
extern ScriptClassDesc_t * GetScriptDesc( CBaseEntity * );
@@ -480,6 +483,14 @@ bool VScriptServerInit()
ScriptLanguage_t scriptLanguage = SL_DEFAULT;
char const *pszScriptLanguage;
#ifdef MAPBASE_VSCRIPT
if (GetWorldEntity()->GetScriptLanguage() != SL_NONE)
{
// Allow world entity to override script language
scriptLanguage = GetWorldEntity()->GetScriptLanguage();
}
else
#endif
if ( CommandLine()->CheckParm( "-scriptlang", &pszScriptLanguage ) )
{
if( !Q_stricmp(pszScriptLanguage, "gamemonkey") )
@@ -494,6 +505,12 @@ bool VScriptServerInit()
{
scriptLanguage = SL_PYTHON;
}
#ifdef MAPBASE_VSCRIPT
else if( !Q_stricmp(pszScriptLanguage, "lua") )
{
scriptLanguage = SL_LUA;
}
#endif
else
{
DevWarning("-server_script does not recognize a language named '%s'. virtual machine did NOT start.\n", pszScriptLanguage );
@@ -716,8 +733,17 @@ public:
CVScriptGameSystem g_VScriptGameSystem;
#ifdef MAPBASE_VSCRIPT
ConVar script_allow_entity_creation_midgame( "script_allow_entity_creation_midgame", "1", FCVAR_NOT_CONNECTED, "Allows VScript files to create entities mid-game, as opposed to only creating entities on startup." );
#endif
bool IsEntityCreationAllowedInScripts( void )
{
#ifdef MAPBASE_VSCRIPT
if (script_allow_entity_creation_midgame.GetBool())
return true;
#endif
return g_VScriptGameSystem.m_bAllowEntityCreationInScripts;
}