mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-11 20:11:33 +03:00
baseentity_shared.cpp baseentity.cpp c_baseentity.h c_baseentity.cpp c_world.h - Fixed critical ScriptSetContextThink bugs - Added C_BaseEntity::SetContextThink (ScriptSetContextThink) - Added C_BaseEntity::SetSize - Added C_BaseEntity::SetModel - Added C_BaseEntity::Destroy baseentity.h baseentity.cpp - Removed duplicate functions ScriptSetSize and ScriptUtilRemove player.cpp - Moved player script instance registration before player_spawn event vscript_server.cpp - Added CEntities::FindByClassNearestFacing vscript_funcs_shared.cpp - Added GetFrameCount - Added IntervalPerTick vscript_singletons.cpp - Better game event descriptors for CScriptGameEventListener - Added ::effects (CEffectsScriptHelper) - Added ::Convars (CScriptConvarAccessor) vscript_shared.cpp - Fixed clientside entity printing in script VM mapbase_con_groups.h mapbase_con_groups.cpp - Improved performance by changing string comparisons to direct array access vscript_bindings_base.h vscript_bindings_base.cpp - Added CScriptKeyValues::SubKeysToTable vscript_bindings_math.cpp - Added ::SimpleSplineRemapVal - Added ::SimpleSplineRemapValClamped - Added ::Bias - Added ::Gain - Added ::SmoothCurve - Added ::SmoothCurve_Tweak - Added ::ExponentialDecay vscript_squirrel.nut - Added ::Lerp - Added ::FLerp - Added ::SimpleSpline vscript_squirrel.cpp - Added Vector::_unm - Added Vector::Set - Added Vector::Add - Added Vector::Subtract - Added Vector::Multiply - Added Vector::Divide - Added Vector::DistTo - Added Vector::DistToSqr - Added Vector::IsEqualTo - Added Vector::WithinAABox - Added Vector::FromKVString - Changed vector print syntax
167 lines
3.6 KiB
Plaintext
167 lines
3.6 KiB
Plaintext
static char g_Script_vscript_server[] = R"vscript(
|
|
//========== Copyright © 2008, Valve Corporation, All rights reserved. ========
|
|
//
|
|
// Purpose:
|
|
//
|
|
//=============================================================================
|
|
|
|
local DoEntFire = DoEntFire
|
|
local DoEntFireByInstanceHandle = DoEntFireByInstanceHandle
|
|
local DoDispatchParticleEffect = DoDispatchParticleEffect
|
|
local DoUniqueString = DoUniqueString
|
|
|
|
function UniqueString( string = "" )
|
|
{
|
|
return DoUniqueString( "" + string );
|
|
}
|
|
|
|
function EntFire( target, action, value = null, delay = 0.0, activator = null, caller = null )
|
|
{
|
|
if ( !value )
|
|
{
|
|
value = "";
|
|
}
|
|
|
|
if ( "self" in this )
|
|
{
|
|
if ( !caller )
|
|
{
|
|
caller = self;
|
|
}
|
|
|
|
if ( !activator )
|
|
{
|
|
activator = self;
|
|
}
|
|
}
|
|
|
|
return DoEntFire( "" + target, "" + action, "" + value, delay, activator, caller );
|
|
}
|
|
|
|
function EntFireByHandle( target, action, value = null, delay = 0.0, activator = null, caller = null )
|
|
{
|
|
if ( !value )
|
|
{
|
|
value = "";
|
|
}
|
|
|
|
if ( "self" in this )
|
|
{
|
|
if ( !caller )
|
|
{
|
|
caller = self;
|
|
}
|
|
|
|
if ( !activator )
|
|
{
|
|
activator = self;
|
|
}
|
|
}
|
|
|
|
return DoEntFireByInstanceHandle( target, "" + action, "" + value, delay, activator, caller );
|
|
}
|
|
|
|
function DispatchParticleEffect( particleName, origin, angles, entity = null )
|
|
{
|
|
DoDispatchParticleEffect( particleName, origin, angles, entity );
|
|
}
|
|
|
|
__Documentation.RegisterHelp( "CConvars::GetClientConvarValue", "CConvars::GetClientConvarValue(string, int)", "Returns the convar value for the entindex as a string. Only works with client convars with the FCVAR_USERINFO flag." );
|
|
|
|
function __ReplaceClosures( script, scope )
|
|
{
|
|
if ( !scope )
|
|
{
|
|
scope = getroottable();
|
|
}
|
|
|
|
local tempParent = { getroottable = function() { return null; } };
|
|
local temp = { runscript = script };
|
|
temp.set_delegate(tempParent);
|
|
|
|
temp.runscript()
|
|
foreach( key,val in temp )
|
|
{
|
|
if ( typeof(val) == "function" && key != "runscript" )
|
|
{
|
|
printl( " Replacing " + key );
|
|
scope[key] <- val;
|
|
}
|
|
}
|
|
}
|
|
|
|
local __OutputsPattern = regexp("^On.*Output$");
|
|
|
|
function ConnectOutputs( table )
|
|
{
|
|
local nCharsToStrip = 6;
|
|
foreach( key, val in table )
|
|
{
|
|
if ( typeof( val ) == "function" && __OutputsPattern.match( key ) )
|
|
{
|
|
//printl(key.slice( 0, nCharsToStrip ) );
|
|
table.self.ConnectOutput( key.slice( 0, key.len() - nCharsToStrip ), key );
|
|
}
|
|
}
|
|
}
|
|
|
|
function IncludeScript( name, scope = null )
|
|
{
|
|
if ( !scope )
|
|
{
|
|
scope = this;
|
|
}
|
|
return ::DoIncludeScript( name, scope );
|
|
}
|
|
|
|
//---------------------------------------------------------
|
|
// Text dump this scope's contents to the console.
|
|
//---------------------------------------------------------
|
|
function __DumpScope( depth, table )
|
|
{
|
|
local indent=function( count )
|
|
{
|
|
local i;
|
|
for( i = 0 ; i < count ; i++ )
|
|
{
|
|
print(" ");
|
|
}
|
|
}
|
|
|
|
foreach(key, value in table)
|
|
{
|
|
indent(depth);
|
|
print( key );
|
|
switch (type(value))
|
|
{
|
|
case "table":
|
|
print("(TABLE)\n");
|
|
indent(depth);
|
|
print("{\n");
|
|
__DumpScope( depth + 1, value);
|
|
indent(depth);
|
|
print("}");
|
|
break;
|
|
case "array":
|
|
print("(ARRAY)\n");
|
|
indent(depth);
|
|
print("[\n")
|
|
__DumpScope( depth + 1, value);
|
|
indent(depth);
|
|
print("]");
|
|
break;
|
|
case "string":
|
|
print(" = \"");
|
|
print(value);
|
|
print("\"");
|
|
break;
|
|
default:
|
|
print(" = ");
|
|
print(value);
|
|
break;
|
|
}
|
|
print("\n");
|
|
}
|
|
}
|
|
|
|
)vscript"; |