Prevent nesting in serialisation of Precache functions

On every save on a load, these functions would keep reference to their old versions
from the previous save which kept stacking up on each load-save
This commit is contained in:
samisalreadytaken 2022-12-12 10:44:22 +03:00
parent af6c22e058
commit 7525068fc0
2 changed files with 6 additions and 7 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." );
local PrecacheModel = PrecacheModel
local PrecacheModel = DoPrecacheModel
function PrecacheModel( a, b = true )
{
return PrecacheModel( a, b )
}
local PrecacheOther = PrecacheOther
local PrecacheOther = DoPrecacheOther
function PrecacheOther( a, b = "" )
{
PrecacheOther( a, b )
return PrecacheOther( a, b )
}
function __ReplaceClosures( script, scope )
@ -106,10 +106,9 @@ function __ReplaceClosures( script, scope )
}
}
local __OutputsPattern = regexp("^On.*Output$");
function ConnectOutputs( table )
{
local __OutputsPattern = regexp("^On.*Output$");
local nCharsToStrip = 6;
foreach( key, val in table )
{

View File

@ -1049,10 +1049,10 @@ void RegisterSharedScriptFunctions()
//
// 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, 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