Skip to content

Commit cdc8741

Browse files
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
1 parent 001ad89 commit cdc8741

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

sp/src/game/server/vscript_server.nut

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ function ImpulseScale( flTargetMass, flDesiredSpeed )
7272
}
7373
__Documentation.RegisterHelp( "ImpulseScale", "float ImpulseScale(float, float)", "Returns an impulse scale required to push an object." );
7474
75-
local PrecacheModel = PrecacheModel
75+
local PrecacheModel = DoPrecacheModel
7676
function PrecacheModel( a, b = true )
7777
{
7878
return PrecacheModel( a, b )
7979
}
8080
81-
local PrecacheOther = PrecacheOther
81+
local PrecacheOther = DoPrecacheOther
8282
function PrecacheOther( a, b = "" )
8383
{
84-
PrecacheOther( a, b )
84+
return PrecacheOther( a, b )
8585
}
8686
8787
function __ReplaceClosures( script, scope )
@@ -106,10 +106,9 @@ function __ReplaceClosures( script, scope )
106106
}
107107
}
108108

109-
local __OutputsPattern = regexp("^On.*Output$");
110-
111109
function ConnectOutputs( table )
112110
{
111+
local __OutputsPattern = regexp("^On.*Output$");
113112
local nCharsToStrip = 6;
114113
foreach( key, val in table )
115114
{

sp/src/game/shared/mapbase/vscript_funcs_shared.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,10 +1049,10 @@ void RegisterSharedScriptFunctions()
10491049
//
10501050
// Precaching
10511051
//
1052-
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptPrecacheModel, "PrecacheModel", "Precaches a model for later usage." );
1052+
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptPrecacheModel, "DoPrecacheModel", SCRIPT_ALIAS( "PrecacheModel", "Precaches a model for later usage." ) );
10531053
ScriptRegisterFunction( g_pScriptVM, PrecacheMaterial, "Precaches a material for later usage." );
10541054
ScriptRegisterFunction( g_pScriptVM, PrecacheParticleSystem, "Precaches a particle system for later usage." );
1055-
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptPrecacheOther, "PrecacheOther", "Precaches an entity class for later usage." );
1055+
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptPrecacheOther, "DoPrecacheOther", SCRIPT_ALIAS( "PrecacheOther", "Precaches an entity class for later usage." ) );
10561056

10571057
//
10581058
// NPCs

0 commit comments

Comments
 (0)