samisalreadytaken 599a93e7bc vscript additions and fixes:
baseanimating.h
baseanimating.cpp
   - Added CBaseAnimating::SequenceDuration (ScriptSequenceDuration)
   - Added CBaseAnimating::GetPlaybackRate
   - Added CBaseAnimating::SetPlaybackRate
   - Added CBaseAnimating::GetCycle
   - Added CBaseAnimating::SetCycle

triggers.h
triggers.cpp
   - Fixed CTriggerCamera::ScriptSetFov setting player FOV while disabled
   - Added CBaseTrigger::Enable
   - Added CBaseTrigger::Disable
   - Added CBaseTrigger::TouchTest
   - Added CBaseTrigger::IsTouching (ScriptIsTouching)

vscript_server.nut
vscript_server.cpp
   - Added CEntities::FindByClassnameWithinBox
   - Added ::SendToConsoleServer
   - Added ::CancelEntityIOEvent
   - Added ::GetEntityIOEventTimeLeft
   - Moved ScriptDispatchParticleEffect to shared code

eventqueue.h
cbase.h
cbase.cpp
   - Set entity I/O con output colour
   - Added (CEventQueue::CancelEventsByInput)
   - Added (CEventQueue::RemoveEvent)
   - Added (CEventQueue::GetTimeLeft)

baseentity.h
baseentity.cpp
   - Added CBaseEntity::SetTransmitState
   - Added CBaseEntity::GetTransmitState
   - Added CBaseEntity::AcceptInput (ScriptAcceptInput)
   - Added CBaseEntity::FireOutput (ScriptFireOutput)
   - Added CBaseEntity::GetMaxOutputDelay
   - Added CBaseEntity::CancelEventsByInput
   - Added player_use event on InputUse
   - Fixed InputKill on players

ivscript.h
vscript_squirrel.cpp
   - Added IScriptVM::ArrayAppend
   - Fixed buffer overflow crash
   - Increased print buffer to 2048 from 256
   - Set vscript print output colour

vscript_funcs_shared.cpp
   - Added CNetMsgScriptHelper
     (CScriptGameEventListener)
   - Added ::ListenToGameEvent
   - Added ::StopListeningToGameEvent
   - Added ::StopListeningToAllGameEvents
   - Added ::FireGameEvent
   - Added ::FireGameEventLocal
     (CScriptSaveRestoreUtil)
   - Added ::SaveTable
   - Added ::RestoreTable
   - Added ::ClearSavedTable
   - Added callbacks ::OnSave, ::OnRestore
     (CScriptReadWriteFile)
   - Added ::StringToFile
   - Added ::FileToString
   - Added GlobalSys::GetCommandLine
   - Added GlobalSys::CommandLineCheck
   - Added GlobalSys::CommandLineCheckStr
   - Added GlobalSys::CommandLineCheckFloat
   - Added GlobalSys::CommandLineCheckInt
   - Added ::GetCPUUsage
   - Added ::NXPrint
   - Added ::Msg (ScriptMsg)
   - Removed misplaced condition checks
   - Fixed ScriptEntitiesInBox, *AtPoint, *InSphere

logic_eventlistener.cpp
   - Removed redundant dev msg

gamestringpool.cpp
   - Fixed string pool dump sort
2020-10-27 02:22:18 +03:00

158 lines
3.1 KiB
Plaintext

static char g_Script_vscript_server[] = R"vscript(
//========== Copyright © 2008, Valve Corporation, All rights reserved. ========
//
// Purpose:
//
//=============================================================================
function UniqueString( string = "" )
{
return ::DoUniqueString( string.tostring() );
}
local DoEntFire = ::DoEntFire
local DoEntFireByInstanceHandle = ::DoEntFireByInstanceHandle
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.tostring(), action.tostring(), value.tostring(), 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.tostring(), value.tostring(), delay, activator, caller );
}
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";