mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-23 20:09:45 +03:00
vscript changes:
c_baseentity.h c_baseentity.cpp - Renamed GetLeftVector to GetRightVector - Renamed GetTeamNumber to GetTeam baseentity.h baseentity.cpp - Renamed GetLeftVector to GetRightVector - Renamed Get/SetRender functions (GetAlpha -> GetRenderAlpha) - Fixed CBaseEntity::GetScriptId - Added hook CBaseEntity::UpdateOnRemove - Added CBaseEntity::GetOrCreatePrivateScriptScope - Added CBaseEntity::GetDebugName - Added CBaseEntity::GetGravity - Added CBaseEntity::SetGravity - Added CBaseEntity::GetFriction - Added CBaseEntity::SetFriction - Added CBaseEntity::GetMass - Added CBaseEntity::SetMass - Added CBaseEntity::SetName (SetNameAsCStr) - Added CBaseEntity::SetParent (ScriptSetParent) - Added CBaseEntity::SetThink (ScriptSetThink) - Added CBaseEntity::StopThink (ScriptStopThink) - Added CBaseEntity::SetThinkFunction (ScriptSetThinkFunction) - Added CBaseEntity::StopThinkFunction (ScriptStopThinkFunction) - Added CBaseEntity::ApplyAbsVelocityImpulse - Added CBaseEntity::ApplyLocalAngularVelocityImpulse player.h player.cpp - Renamed GetPlayerUserId to GetUserID - Added CBasePlayer::GetFOV - Added CBasePlayer::GetFOVOwner (ScriptGetFOVOwner) - Added CBasePlayer::SetFOV (ScriptSetFOV) vscript_consts_shared.cpp -Added RAD2DEG, DEG2RAD, MAX_COORD_FLOAT, MAX_TRACE_LENGTH vscript_funcs_shared.cpp - Renamed IsClientScript,IsServerScript to IsClient,IsServer - Added IsDedicatedServer - Added NPrint (Con_NPrintf) - Removed DebugDrawBoxDirection (debugoverlay.BoxDirection) - Removed DebugDrawText (debugoverlay.Text) vscript_server.cpp - Added CDebugOverlayScriptHelper (debugoverlay) - Added CEntities::GetLocalPlayer - Added DispatchParticleEffect (ScriptDispatchParticleEffect) - Removed DebugDrawBox (debugoverlay.Box) - Removed DebugDrawLine (debugoverlay.Line) vscript_squirrel.cpp - Changed stub error messages for consistency and clarity - Changed errorfunc output to Warning instead of Msg - Added Msg, Warning - Added clamp, min, max, RemapVal, RemapValClamped - Added sqstdtime.h - Added clock, time, date
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "gamerules.h"
|
||||
#include "vscript_server.nut"
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
#include "particle_parse.h"
|
||||
#include "world.h"
|
||||
#endif
|
||||
|
||||
@@ -43,6 +44,12 @@ extern ScriptClassDesc_t * GetScriptDesc( CBaseEntity * );
|
||||
class CScriptEntityIterator
|
||||
{
|
||||
public:
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
HSCRIPT GetLocalPlayer()
|
||||
{
|
||||
return ToHScript( UTIL_GetLocalPlayerOrListenServerHost() );
|
||||
}
|
||||
#endif
|
||||
HSCRIPT First() { return Next(NULL); }
|
||||
|
||||
HSCRIPT Next( HSCRIPT hStartEntity )
|
||||
@@ -104,6 +111,9 @@ private:
|
||||
} g_ScriptEntityIterator;
|
||||
|
||||
BEGIN_SCRIPTDESC_ROOT_NAMED( CScriptEntityIterator, "CEntities", SCRIPT_SINGLETON "The global list of entities" )
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
DEFINE_SCRIPTFUNC( GetLocalPlayer, "Get local player or listen server host" )
|
||||
#endif
|
||||
DEFINE_SCRIPTFUNC( First, "Begin an iteration over the list of entities" )
|
||||
DEFINE_SCRIPTFUNC( Next, "Continue an iteration over the list of entities, providing reference to a previously found entity" )
|
||||
DEFINE_SCRIPTFUNC( CreateByClassname, "Creates an entity by classname" )
|
||||
@@ -323,7 +333,422 @@ CScriptKeyValues::~CScriptKeyValues( )
|
||||
m_pKeyValues = NULL;
|
||||
}
|
||||
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
#define RETURN_IF_CANNOT_DRAW_OVERLAY\
|
||||
if (engine->IsPaused())\
|
||||
{\
|
||||
DevWarning("debugoverlay: cannot draw while the game paused!\n");\
|
||||
return;\
|
||||
}
|
||||
class CDebugOverlayScriptHelper
|
||||
{
|
||||
public:
|
||||
|
||||
void Box(const Vector &origin, const Vector &mins, const Vector &maxs, int r, int g, int b, int a, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->AddBoxOverlay(origin, mins, maxs, vec3_angle, r, g, b, a, flDuration);
|
||||
}
|
||||
}
|
||||
void BoxDirection(const Vector &origin, const Vector &mins, const Vector &maxs, const Vector &forward, int r, int g, int b, int a, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
QAngle f_angles = vec3_angle;
|
||||
f_angles.y = UTIL_VecToYaw(forward);
|
||||
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->AddBoxOverlay(origin, mins, maxs, f_angles, r, g, b, a, flDuration);
|
||||
}
|
||||
}
|
||||
void BoxAngles(const Vector &origin, const Vector &mins, const Vector &maxs, const QAngle &angles, int r, int g, int b, int a, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->AddBoxOverlay(origin, mins, maxs, angles, r, g, b, a, flDuration);
|
||||
}
|
||||
}
|
||||
void SweptBox(const Vector& start, const Vector& end, const Vector& mins, const Vector& maxs, const QAngle & angles, int r, int g, int b, int a, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->AddSweptBoxOverlay(start, end, mins, maxs, angles, r, g, b, a, flDuration);
|
||||
}
|
||||
}
|
||||
void EntityBounds(HSCRIPT pEntity, int r, int g, int b, int a, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
const CCollisionProperty *pCollide = ToEnt(pEntity)->CollisionProp();
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->AddBoxOverlay(pCollide->GetCollisionOrigin(), pCollide->OBBMins(), pCollide->OBBMaxs(), pCollide->GetCollisionAngles(), r, g, b, a, flDuration);
|
||||
}
|
||||
}
|
||||
void Line(const Vector &origin, const Vector &target, int r, int g, int b, bool noDepthTest, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->AddLineOverlay(origin, target, r, g, b, noDepthTest, flDuration);
|
||||
}
|
||||
}
|
||||
void Triangle(const Vector &p1, const Vector &p2, const Vector &p3, int r, int g, int b, int a, bool noDepthTest, float duration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->AddTriangleOverlay(p1, p2, p3, r, g, b, a, noDepthTest, duration);
|
||||
}
|
||||
}
|
||||
void EntityText(int entityID, int text_offset, const char *text, float flDuration, int r, int g, int b, int a)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->AddEntityTextOverlay(entityID, text_offset, flDuration,
|
||||
(int)clamp(r * 255.f, 0.f, 255.f), (int)clamp(g * 255.f, 0.f, 255.f), (int)clamp(b * 255.f, 0.f, 255.f),
|
||||
(int)clamp(a * 255.f, 0.f, 255.f), text);
|
||||
}
|
||||
}
|
||||
void EntityTextAtPosition(const Vector &origin, int text_offset, const char *text, float flDuration, int r, int g, int b, int a)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->AddTextOverlayRGB(origin, text_offset, flDuration, r, g, b, a, "%s", text);
|
||||
}
|
||||
}
|
||||
void Grid(const Vector &vPosition)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->AddGridOverlay(vPosition);
|
||||
}
|
||||
}
|
||||
void Text(const Vector &origin, const char *text, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->AddTextOverlay(origin, flDuration, "%s", text);
|
||||
}
|
||||
}
|
||||
void ScreenText(float fXpos, float fYpos, const char *text, int r, int g, int b, int a, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->AddScreenTextOverlay(fXpos, fYpos, flDuration, r, g, b, a, text);
|
||||
}
|
||||
}
|
||||
void Cross3D(const Vector &position, float size, int r, int g, int b, bool noDepthTest, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
Line( position + Vector(size,0,0), position - Vector(size,0,0), r, g, b, noDepthTest, flDuration );
|
||||
Line( position + Vector(0,size,0), position - Vector(0,size,0), r, g, b, noDepthTest, flDuration );
|
||||
Line( position + Vector(0,0,size), position - Vector(0,0,size), r, g, b, noDepthTest, flDuration );
|
||||
}
|
||||
void Cross3DOriented(const Vector &position, const QAngle &angles, float size, int r, int g, int b, bool noDepthTest, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
Vector forward, right, up;
|
||||
AngleVectors( angles, &forward, &right, &up );
|
||||
|
||||
forward *= size;
|
||||
right *= size;
|
||||
up *= size;
|
||||
|
||||
Line( position + right, position - right, r, g, b, noDepthTest, flDuration );
|
||||
Line( position + forward, position - forward, r, g, b, noDepthTest, flDuration );
|
||||
Line( position + up, position - up, r, g, b, noDepthTest, flDuration );
|
||||
}
|
||||
void DrawTickMarkedLine(const Vector &startPos, const Vector &endPos, float tickDist, int tickTextDist, int r, int g, int b, bool noDepthTest, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
Vector lineDir = (endPos - startPos);
|
||||
float lineDist = VectorNormalize(lineDir);
|
||||
int numTicks = lineDist / tickDist;
|
||||
|
||||
Vector upVec = Vector(0,0,4);
|
||||
Vector sideDir;
|
||||
Vector tickPos = startPos;
|
||||
int tickTextCnt = 0;
|
||||
|
||||
CrossProduct(lineDir, upVec, sideDir);
|
||||
|
||||
Line(startPos, endPos, r, g, b, noDepthTest, flDuration);
|
||||
|
||||
for (int i = 0; i<numTicks + 1; i++)
|
||||
{
|
||||
Vector tickLeft = tickPos - sideDir;
|
||||
Vector tickRight = tickPos + sideDir;
|
||||
|
||||
if (tickTextCnt == tickTextDist)
|
||||
{
|
||||
char text[25];
|
||||
Q_snprintf(text, sizeof(text), "%i", i);
|
||||
Vector textPos = tickLeft + Vector(0, 0, 8);
|
||||
Line(tickLeft, tickRight, 255, 255, 255, noDepthTest, flDuration);
|
||||
Text(textPos, text, flDuration);
|
||||
tickTextCnt = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Line(tickLeft, tickRight, r, g, b, noDepthTest, flDuration);
|
||||
}
|
||||
|
||||
tickTextCnt++;
|
||||
|
||||
tickPos = tickPos + (tickDist * lineDir);
|
||||
}
|
||||
}
|
||||
void HorzArrow(const Vector &startPos, const Vector &endPos, float width, int r, int g, int b, int a, bool noDepthTest, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
Vector lineDir = (endPos - startPos);
|
||||
VectorNormalize( lineDir );
|
||||
Vector upVec = Vector( 0, 0, 1 );
|
||||
Vector sideDir;
|
||||
float radius = width / 2.0;
|
||||
|
||||
CrossProduct(lineDir, upVec, sideDir);
|
||||
|
||||
Vector p1 = startPos - sideDir * radius;
|
||||
Vector p2 = endPos - lineDir * width - sideDir * radius;
|
||||
Vector p3 = endPos - lineDir * width - sideDir * width;
|
||||
Vector p4 = endPos;
|
||||
Vector p5 = endPos - lineDir * width + sideDir * width;
|
||||
Vector p6 = endPos - lineDir * width + sideDir * radius;
|
||||
Vector p7 = startPos + sideDir * radius;
|
||||
|
||||
Line(p1, p2, r,g,b,noDepthTest,flDuration);
|
||||
Line(p2, p3, r,g,b,noDepthTest,flDuration);
|
||||
Line(p3, p4, r,g,b,noDepthTest,flDuration);
|
||||
Line(p4, p5, r,g,b,noDepthTest,flDuration);
|
||||
Line(p5, p6, r,g,b,noDepthTest,flDuration);
|
||||
Line(p6, p7, r,g,b,noDepthTest,flDuration);
|
||||
|
||||
if ( a > 0 )
|
||||
{
|
||||
Triangle( p5, p4, p3, r, g, b, a, noDepthTest, flDuration );
|
||||
Triangle( p1, p7, p6, r, g, b, a, noDepthTest, flDuration );
|
||||
Triangle( p6, p2, p1, r, g, b, a, noDepthTest, flDuration );
|
||||
|
||||
Triangle( p3, p4, p5, r, g, b, a, noDepthTest, flDuration );
|
||||
Triangle( p6, p7, p1, r, g, b, a, noDepthTest, flDuration );
|
||||
Triangle( p1, p2, p6, r, g, b, a, noDepthTest, flDuration );
|
||||
}
|
||||
}
|
||||
void YawArrow(const Vector &startPos, float yaw, float length, float width, int r, int g, int b, int a, bool noDepthTest, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
Vector forward = UTIL_YawToVector( yaw );
|
||||
HorzArrow( startPos, startPos + forward * length, width, r, g, b, a, noDepthTest, flDuration );
|
||||
}
|
||||
void VertArrow(const Vector &startPos, const Vector &endPos, float width, int r, int g, int b, int a, bool noDepthTest, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
Vector lineDir = (endPos - startPos);
|
||||
VectorNormalize( lineDir );
|
||||
Vector upVec;
|
||||
Vector sideDir;
|
||||
float radius = width / 2.0;
|
||||
|
||||
VectorVectors( lineDir, sideDir, upVec );
|
||||
|
||||
Vector p1 = startPos - upVec * radius;
|
||||
Vector p2 = endPos - lineDir * width - upVec * radius;
|
||||
Vector p3 = endPos - lineDir * width - upVec * width;
|
||||
Vector p4 = endPos;
|
||||
Vector p5 = endPos - lineDir * width + upVec * width;
|
||||
Vector p6 = endPos - lineDir * width + upVec * radius;
|
||||
Vector p7 = startPos + upVec * radius;
|
||||
|
||||
Line(p1, p2, r,g,b,noDepthTest,flDuration);
|
||||
Line(p2, p3, r,g,b,noDepthTest,flDuration);
|
||||
Line(p3, p4, r,g,b,noDepthTest,flDuration);
|
||||
Line(p4, p5, r,g,b,noDepthTest,flDuration);
|
||||
Line(p5, p6, r,g,b,noDepthTest,flDuration);
|
||||
Line(p6, p7, r,g,b,noDepthTest,flDuration);
|
||||
|
||||
if ( a > 0 )
|
||||
{
|
||||
Triangle( p5, p4, p3, r, g, b, a, noDepthTest, flDuration );
|
||||
Triangle( p1, p7, p6, r, g, b, a, noDepthTest, flDuration );
|
||||
Triangle( p6, p2, p1, r, g, b, a, noDepthTest, flDuration );
|
||||
|
||||
Triangle( p3, p4, p5, r, g, b, a, noDepthTest, flDuration );
|
||||
Triangle( p6, p7, p1, r, g, b, a, noDepthTest, flDuration );
|
||||
Triangle( p1, p2, p6, r, g, b, a, noDepthTest, flDuration );
|
||||
}
|
||||
}
|
||||
void Axis(const Vector &position, const QAngle &angles, float size, bool noDepthTest, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
Vector xvec, yvec, zvec;
|
||||
AngleVectors( angles, &xvec, &yvec, &zvec );
|
||||
|
||||
xvec = position + (size * xvec);
|
||||
yvec = position - (size * yvec);
|
||||
zvec = position + (size * zvec);
|
||||
|
||||
Line( position, xvec, 255, 0, 0, noDepthTest, flDuration );
|
||||
Line( position, yvec, 0, 255, 0, noDepthTest, flDuration );
|
||||
Line( position, zvec, 0, 0, 255, noDepthTest, flDuration );
|
||||
}
|
||||
void Sphere(const Vector ¢er, float radius, int r, int g, int b, bool noDepthTest, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
Vector edge, lastEdge;
|
||||
|
||||
float axisSize = radius;
|
||||
Line( center + Vector( 0, 0, -axisSize ), center + Vector( 0, 0, axisSize ), r, g, b, noDepthTest, flDuration );
|
||||
Line( center + Vector( 0, -axisSize, 0 ), center + Vector( 0, axisSize, 0 ), r, g, b, noDepthTest, flDuration );
|
||||
Line( center + Vector( -axisSize, 0, 0 ), center + Vector( axisSize, 0, 0 ), r, g, b, noDepthTest, flDuration );
|
||||
|
||||
lastEdge = Vector( radius + center.x, center.y, center.z );
|
||||
float angle;
|
||||
for( angle=0.0f; angle <= 360.0f; angle += 22.5f )
|
||||
{
|
||||
edge.x = radius * cosf( angle / 180.0f * M_PI ) + center.x;
|
||||
edge.y = center.y;
|
||||
edge.z = radius * sinf( angle / 180.0f * M_PI ) + center.z;
|
||||
|
||||
Line( edge, lastEdge, r, g, b, noDepthTest, flDuration );
|
||||
|
||||
lastEdge = edge;
|
||||
}
|
||||
|
||||
lastEdge = Vector( center.x, radius + center.y, center.z );
|
||||
for( angle=0.0f; angle <= 360.0f; angle += 22.5f )
|
||||
{
|
||||
edge.x = center.x;
|
||||
edge.y = radius * cosf( angle / 180.0f * M_PI ) + center.y;
|
||||
edge.z = radius * sinf( angle / 180.0f * M_PI ) + center.z;
|
||||
|
||||
Line( edge, lastEdge, r, g, b, noDepthTest, flDuration );
|
||||
|
||||
lastEdge = edge;
|
||||
}
|
||||
|
||||
lastEdge = Vector( center.x, radius + center.y, center.z );
|
||||
for( angle=0.0f; angle <= 360.0f; angle += 22.5f )
|
||||
{
|
||||
edge.x = radius * cosf( angle / 180.0f * M_PI ) + center.x;
|
||||
edge.y = radius * sinf( angle / 180.0f * M_PI ) + center.y;
|
||||
edge.z = center.z;
|
||||
|
||||
Line( edge, lastEdge, r, g, b, noDepthTest, flDuration );
|
||||
|
||||
lastEdge = edge;
|
||||
}
|
||||
}
|
||||
void CircleOriented(const Vector &position, const QAngle &angles, float radius, int r, int g, int b, int a, bool bNoDepthTest, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
matrix3x4_t xform;
|
||||
AngleMatrix(angles, position, xform);
|
||||
Vector xAxis, yAxis;
|
||||
MatrixGetColumn(xform, 2, xAxis);
|
||||
MatrixGetColumn(xform, 1, yAxis);
|
||||
Circle(position, xAxis, yAxis, radius, r, g, b, a, bNoDepthTest, flDuration);
|
||||
}
|
||||
void Circle(const Vector &position, const Vector &xAxis, const Vector &yAxis, float radius, int r, int g, int b, int a, bool bNoDepthTest, float flDuration)
|
||||
{
|
||||
RETURN_IF_CANNOT_DRAW_OVERLAY
|
||||
|
||||
const unsigned int nSegments = 16;
|
||||
const float flRadStep = (M_PI*2.0f) / (float) nSegments;
|
||||
|
||||
Vector vecLastPosition;
|
||||
Vector vecStart = position + xAxis * radius;
|
||||
Vector vecPosition = vecStart;
|
||||
|
||||
for ( int i = 1; i <= nSegments; i++ )
|
||||
{
|
||||
vecLastPosition = vecPosition;
|
||||
|
||||
float flSin, flCos;
|
||||
SinCos( flRadStep*i, &flSin, &flCos );
|
||||
vecPosition = position + (xAxis * flCos * radius) + (yAxis * flSin * radius);
|
||||
|
||||
Line( vecLastPosition, vecPosition, r, g, b, bNoDepthTest, flDuration );
|
||||
|
||||
if ( a && i > 1 )
|
||||
{
|
||||
debugoverlay->AddTriangleOverlay( vecStart, vecLastPosition, vecPosition, r, g, b, a, bNoDepthTest, flDuration );
|
||||
}
|
||||
}
|
||||
}
|
||||
void ClearAllOverlays()
|
||||
{
|
||||
// Clear all entities of their debug overlays
|
||||
for (CBaseEntity *pEntity = gEntList.FirstEnt(); pEntity; pEntity = gEntList.NextEnt(pEntity))
|
||||
{
|
||||
pEntity->m_debugOverlays = 0;
|
||||
}
|
||||
|
||||
if (debugoverlay)
|
||||
{
|
||||
debugoverlay->ClearAllOverlays();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
} g_ScriptDebugOverlay;
|
||||
|
||||
BEGIN_SCRIPTDESC_ROOT(CDebugOverlayScriptHelper, SCRIPT_SINGLETON "CDebugOverlayScriptHelper")
|
||||
DEFINE_SCRIPTFUNC( Box, "" )
|
||||
DEFINE_SCRIPTFUNC( BoxDirection, "" )
|
||||
DEFINE_SCRIPTFUNC( BoxAngles, "" )
|
||||
DEFINE_SCRIPTFUNC( SweptBox, "" )
|
||||
DEFINE_SCRIPTFUNC( EntityBounds, "" )
|
||||
DEFINE_SCRIPTFUNC( Line, "" )
|
||||
DEFINE_SCRIPTFUNC( Triangle, "" )
|
||||
DEFINE_SCRIPTFUNC( EntityText, "" )
|
||||
DEFINE_SCRIPTFUNC( EntityTextAtPosition, "" )
|
||||
DEFINE_SCRIPTFUNC( Grid, "" )
|
||||
DEFINE_SCRIPTFUNC( Text, "" )
|
||||
DEFINE_SCRIPTFUNC( ScreenText, "" )
|
||||
DEFINE_SCRIPTFUNC( Cross3D, "" )
|
||||
DEFINE_SCRIPTFUNC( Cross3DOriented, "" )
|
||||
DEFINE_SCRIPTFUNC( DrawTickMarkedLine, "" )
|
||||
DEFINE_SCRIPTFUNC( HorzArrow, "" )
|
||||
DEFINE_SCRIPTFUNC( YawArrow, "" )
|
||||
DEFINE_SCRIPTFUNC( VertArrow, "" )
|
||||
DEFINE_SCRIPTFUNC( Axis, "" )
|
||||
DEFINE_SCRIPTFUNC( Sphere, "" )
|
||||
DEFINE_SCRIPTFUNC( CircleOriented, "" )
|
||||
DEFINE_SCRIPTFUNC( Circle, "" )
|
||||
DEFINE_SCRIPTFUNC( ClearAllOverlays, "" )
|
||||
END_SCRIPTDESC();
|
||||
#endif // MAPBASE_VSCRIPT
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -484,6 +909,16 @@ static float ScriptTraceLine( const Vector &vecStart, const Vector &vecEnd, HSCR
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
//-----------------------------------------------------------------------------
|
||||
// Simple particle effect dispatch
|
||||
//-----------------------------------------------------------------------------
|
||||
static void ScriptDispatchParticleEffect(const char *pszParticleName, const Vector &vecOrigin, const QAngle &vecAngles)
|
||||
{
|
||||
DispatchParticleEffect(pszParticleName, vecOrigin, vecAngles);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool VScriptServerInit()
|
||||
{
|
||||
VMPROF_START
|
||||
@@ -544,6 +979,7 @@ bool VScriptServerInit()
|
||||
#else
|
||||
Log( "VSCRIPT: Started VScript virtual machine using script language '%s'\n", g_pScriptVM->GetLanguageName() );
|
||||
#endif
|
||||
|
||||
ScriptRegisterFunctionNamed( g_pScriptVM, UTIL_ShowMessageAll, "ShowMessage", "Print a hud message on all clients" );
|
||||
|
||||
ScriptRegisterFunction( g_pScriptVM, SendToConsole, "Send a string to the console as a command" );
|
||||
@@ -557,17 +993,22 @@ bool VScriptServerInit()
|
||||
ScriptRegisterFunction( g_pScriptVM, IntervalPerTick, "Get the interval used between each tick" );
|
||||
ScriptRegisterFunction( g_pScriptVM, DoEntFire, SCRIPT_ALIAS( "EntFire", "Generate an entity i/o event" ) );
|
||||
ScriptRegisterFunction( g_pScriptVM, DoEntFireByInstanceHandle, SCRIPT_ALIAS( "EntFireByHandle", "Generate an entity i/o event. First parameter is an entity instance." ) );
|
||||
// ScriptRegisterFunction( g_pScriptVM, IsValidEntity, "Returns true if the entity is valid." );
|
||||
#else
|
||||
ScriptRegisterFunction( g_pScriptVM, DoEntFire, SCRIPT_ALIAS( "EntFire", "Generate and entity i/o event" ) );
|
||||
ScriptRegisterFunctionNamed( g_pScriptVM, DoEntFireByInstanceHandle, "EntFireByHandle", "Generate and entity i/o event. First parameter is an entity instance." );
|
||||
#endif
|
||||
ScriptRegisterFunction( g_pScriptVM, DoUniqueString, SCRIPT_ALIAS( "UniqueString", "Generate a string guaranteed to be unique across the life of the script VM, with an optional root string. Useful for adding data to tables when not sure what keys are already in use in that table." ) );
|
||||
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptCreateSceneEntity, "CreateSceneEntity", "Create a scene entity to play the specified scene." );
|
||||
#ifndef MAPBASE_VSCRIPT
|
||||
ScriptRegisterFunctionNamed( g_pScriptVM, NDebugOverlay::Box, "DebugDrawBox", "Draw a debug overlay box" );
|
||||
ScriptRegisterFunctionNamed( g_pScriptVM, NDebugOverlay::Line, "DebugDrawLine", "Draw a debug overlay box" );
|
||||
#endif
|
||||
ScriptRegisterFunction( g_pScriptVM, DoIncludeScript, "Execute a script (internal)" );
|
||||
ScriptRegisterFunction( g_pScriptVM, CreateProp, "Create a physics prop" );
|
||||
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptDispatchParticleEffect, "DispatchParticleEffect", "Dispatches a one-off particle system" );
|
||||
#endif
|
||||
|
||||
if ( GameRules() )
|
||||
{
|
||||
@@ -575,6 +1016,9 @@ bool VScriptServerInit()
|
||||
}
|
||||
|
||||
g_pScriptVM->RegisterInstance( &g_ScriptEntityIterator, "Entities" );
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
g_pScriptVM->RegisterInstance( &g_ScriptDebugOverlay, "debugoverlay" );
|
||||
#endif
|
||||
|
||||
#ifdef MAPBASE_VSCRIPT
|
||||
g_pScriptVM->RegisterAllClasses();
|
||||
|
||||
Reference in New Issue
Block a user