Merge pull request #221 from samisalreadytaken/vscript-saverestore

VScript serialisation rewrite
This commit is contained in:
Blixibon 2025-02-01 08:06:34 -06:00 committed by GitHub
commit e68b298a4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 1207 additions and 714 deletions

View File

@ -72,16 +72,16 @@ function ImpulseScale( flTargetMass, flDesiredSpeed )
} }
__Documentation.RegisterHelp( "ImpulseScale", "float ImpulseScale(float, float)", "Returns an impulse scale required to push an object." ); __Documentation.RegisterHelp( "ImpulseScale", "float ImpulseScale(float, float)", "Returns an impulse scale required to push an object." );
local PrecacheModel = PrecacheModel local PrecacheModel = DoPrecacheModel
function PrecacheModel( a, b = true ) function PrecacheModel( a, b = true )
{ {
return PrecacheModel( a, b ) return PrecacheModel( a, b )
} }
local PrecacheOther = PrecacheOther local PrecacheOther = DoPrecacheOther
function PrecacheOther( a, b = "" ) function PrecacheOther( a, b = "" )
{ {
PrecacheOther( a, b ) return PrecacheOther( a, b )
} }
function __ReplaceClosures( script, scope ) function __ReplaceClosures( script, scope )
@ -106,10 +106,9 @@ function __ReplaceClosures( script, scope )
} }
} }
local __OutputsPattern = regexp("^On.*Output$");
function ConnectOutputs( table ) function ConnectOutputs( table )
{ {
local __OutputsPattern = regexp("^On.*Output$");
local nCharsToStrip = 6; local nCharsToStrip = 6;
foreach( key, val in table ) foreach( key, val in table )
{ {

View File

@ -1071,10 +1071,10 @@ void RegisterSharedScriptFunctions()
// //
// Precaching // Precaching
// //
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptPrecacheModel, "PrecacheModel", "Precaches a model for later usage." ); ScriptRegisterFunctionNamed( g_pScriptVM, ScriptPrecacheModel, "DoPrecacheModel", SCRIPT_ALIAS( "PrecacheModel", "Precaches a model for later usage." ) );
ScriptRegisterFunction( g_pScriptVM, PrecacheMaterial, "Precaches a material for later usage." ); ScriptRegisterFunction( g_pScriptVM, PrecacheMaterial, "Precaches a material for later usage." );
ScriptRegisterFunction( g_pScriptVM, PrecacheParticleSystem, "Precaches a particle system for later usage." ); ScriptRegisterFunction( g_pScriptVM, PrecacheParticleSystem, "Precaches a particle system for later usage." );
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptPrecacheOther, "PrecacheOther", "Precaches an entity class for later usage." ); ScriptRegisterFunctionNamed( g_pScriptVM, ScriptPrecacheOther, "DoPrecacheOther", SCRIPT_ALIAS( "PrecacheOther", "Precaches an entity class for later usage." ) );
// //
// NPCs // NPCs

View File

@ -507,7 +507,7 @@ void RunAutorunScripts()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static short VSCRIPT_SERVER_SAVE_RESTORE_VERSION = 2; static short VSCRIPT_SERVER_SAVE_RESTORE_VERSION = 3;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -360,6 +360,7 @@ struct ScriptClassDesc_t
IScriptInstanceHelper * pHelper; // optional helper IScriptInstanceHelper * pHelper; // optional helper
#ifdef MAPBASE_VSCRIPT #ifdef MAPBASE_VSCRIPT
public:
static CUtlVector<ScriptClassDesc_t*>& AllClassesDesc() static CUtlVector<ScriptClassDesc_t*>& AllClassesDesc()
{ {
static CUtlVector<ScriptClassDesc_t*> classes; static CUtlVector<ScriptClassDesc_t*> classes;

File diff suppressed because it is too large Load Diff