2020-05-04 16:25:15 +10:00
//========== Copyright <20> 2008, Valve Corporation, All rights reserved. ========
//
// Purpose:
//
//=============================================================================
# include "cbase.h"
# include "vscript_server.h"
# include "icommandline.h"
# include "tier1/utlbuffer.h"
# include "tier1/fmtstr.h"
# include "filesystem.h"
# include "eventqueue.h"
# include "characterset.h"
# include "sceneentity.h" // for exposing scene precache function
# include "isaverestore.h"
# include "gamerules.h"
2020-05-31 15:39:17 +10:00
# include "vscript_server.nut"
2020-05-27 10:22:45 -05:00
# ifdef MAPBASE_VSCRIPT
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
2020-08-30 15:58:34 +03:00
# include "particle_parse.h"
2020-05-27 10:22:45 -05:00
# include "world.h"
# endif
2020-05-04 16:25:15 +10:00
extern ScriptClassDesc_t * GetScriptDesc ( CBaseEntity * ) ;
// #define VMPROFILE 1
# ifdef VMPROFILE
# define VMPROF_START float debugStartTime = Plat_FloatTime();
# define VMPROF_SHOW( funcname, funcdesc ) DevMsg("***VSCRIPT PROFILE***: %s %s: %6.4f milliseconds\n", (##funcname), (##funcdesc), (Plat_FloatTime() - debugStartTime)*1000.0 );
# else // !VMPROFILE
# define VMPROF_START
# define VMPROF_SHOW
# endif // VMPROFILE
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
class CScriptEntityIterator
{
public :
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
2020-08-30 15:58:34 +03:00
# ifdef MAPBASE_VSCRIPT
HSCRIPT GetLocalPlayer ( )
{
return ToHScript ( UTIL_GetLocalPlayerOrListenServerHost ( ) ) ;
}
# endif
2020-05-04 16:25:15 +10:00
HSCRIPT First ( ) { return Next ( NULL ) ; }
HSCRIPT Next ( HSCRIPT hStartEntity )
{
return ToHScript ( gEntList . NextEnt ( ToEnt ( hStartEntity ) ) ) ;
}
HSCRIPT CreateByClassname ( const char * className )
{
return ToHScript ( CreateEntityByName ( className ) ) ;
}
HSCRIPT FindByClassname ( HSCRIPT hStartEntity , const char * szName )
{
return ToHScript ( gEntList . FindEntityByClassname ( ToEnt ( hStartEntity ) , szName ) ) ;
}
HSCRIPT FindByName ( HSCRIPT hStartEntity , const char * szName )
{
return ToHScript ( gEntList . FindEntityByName ( ToEnt ( hStartEntity ) , szName ) ) ;
}
HSCRIPT FindInSphere ( HSCRIPT hStartEntity , const Vector & vecCenter , float flRadius )
{
return ToHScript ( gEntList . FindEntityInSphere ( ToEnt ( hStartEntity ) , vecCenter , flRadius ) ) ;
}
HSCRIPT FindByTarget ( HSCRIPT hStartEntity , const char * szName )
{
return ToHScript ( gEntList . FindEntityByTarget ( ToEnt ( hStartEntity ) , szName ) ) ;
}
HSCRIPT FindByModel ( HSCRIPT hStartEntity , const char * szModelName )
{
return ToHScript ( gEntList . FindEntityByModel ( ToEnt ( hStartEntity ) , szModelName ) ) ;
}
HSCRIPT FindByNameNearest ( const char * szName , const Vector & vecSrc , float flRadius )
{
return ToHScript ( gEntList . FindEntityByNameNearest ( szName , vecSrc , flRadius ) ) ;
}
HSCRIPT FindByNameWithin ( HSCRIPT hStartEntity , const char * szName , const Vector & vecSrc , float flRadius )
{
return ToHScript ( gEntList . FindEntityByNameWithin ( ToEnt ( hStartEntity ) , szName , vecSrc , flRadius ) ) ;
}
HSCRIPT FindByClassnameNearest ( const char * szName , const Vector & vecSrc , float flRadius )
{
return ToHScript ( gEntList . FindEntityByClassnameNearest ( szName , vecSrc , flRadius ) ) ;
}
HSCRIPT FindByClassnameWithin ( HSCRIPT hStartEntity , const char * szName , const Vector & vecSrc , float flRadius )
{
return ToHScript ( gEntList . FindEntityByClassnameWithin ( ToEnt ( hStartEntity ) , szName , vecSrc , flRadius ) ) ;
}
private :
} g_ScriptEntityIterator ;
BEGIN_SCRIPTDESC_ROOT_NAMED ( CScriptEntityIterator , " CEntities " , SCRIPT_SINGLETON " The global list of entities " )
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
2020-08-30 15:58:34 +03:00
# ifdef MAPBASE_VSCRIPT
DEFINE_SCRIPTFUNC ( GetLocalPlayer , " Get local player or listen server host " )
# endif
2020-05-04 16:25:15 +10:00
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 " )
DEFINE_SCRIPTFUNC ( FindByClassname , " Find entities by class name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search " )
DEFINE_SCRIPTFUNC ( FindByName , " Find entities by name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search " )
DEFINE_SCRIPTFUNC ( FindInSphere , " Find entities within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search " )
DEFINE_SCRIPTFUNC ( FindByTarget , " Find entities by targetname. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search " )
DEFINE_SCRIPTFUNC ( FindByModel , " Find entities by model name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search " )
DEFINE_SCRIPTFUNC ( FindByNameNearest , " Find entities by name nearest to a point. " )
DEFINE_SCRIPTFUNC ( FindByNameWithin , " Find entities by name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search " )
DEFINE_SCRIPTFUNC ( FindByClassnameNearest , " Find entities by class name nearest to a point. " )
DEFINE_SCRIPTFUNC ( FindByClassnameWithin , " Find entities by class name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search " )
END_SCRIPTDESC ( ) ;
// ----------------------------------------------------------------------------
// KeyValues access - CBaseEntity::ScriptGetKeyFromModel returns root KeyValues
// ----------------------------------------------------------------------------
BEGIN_SCRIPTDESC_ROOT ( CScriptKeyValues , " Wrapper class over KeyValues instance " )
DEFINE_SCRIPT_CONSTRUCTOR ( )
DEFINE_SCRIPTFUNC_NAMED ( ScriptFindKey , " FindKey " , " Given a KeyValues object and a key name, find a KeyValues object associated with the key name " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptGetFirstSubKey , " GetFirstSubKey " , " Given a KeyValues object, return the first sub key object " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptGetNextKey , " GetNextKey " , " Given a KeyValues object, return the next key object in a sub key group " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptGetKeyValueInt , " GetKeyInt " , " Given a KeyValues object and a key name, return associated integer value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptGetKeyValueFloat , " GetKeyFloat " , " Given a KeyValues object and a key name, return associated float value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptGetKeyValueBool , " GetKeyBool " , " Given a KeyValues object and a key name, return associated bool value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptGetKeyValueString , " GetKeyString " , " Given a KeyValues object and a key name, return associated string value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptIsKeyValueEmpty , " IsKeyEmpty " , " Given a KeyValues object and a key name, return true if key name has no value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptReleaseKeyValues , " ReleaseKeyValues " , " Given a root KeyValues object, release its contents " ) ;
2020-05-22 20:26:31 -05:00
# ifdef MAPBASE_VSCRIPT
DEFINE_SCRIPTFUNC_NAMED ( ScriptGetName , " GetName " , " Given a KeyValues object, return its name " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptGetInt , " GetInt " , " Given a KeyValues object, return its own associated integer value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptGetFloat , " GetFloat " , " Given a KeyValues object, return its own associated float value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptGetString , " GetString " , " Given a KeyValues object, return its own associated string value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptGetBool , " GetBool " , " Given a KeyValues object, return its own associated bool value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptSetKeyValueInt , " SetKeyInt " , " Given a KeyValues object and a key name, set associated integer value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptSetKeyValueFloat , " SetKeyFloat " , " Given a KeyValues object and a key name, set associated float value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptSetKeyValueBool , " SetKeyBool " , " Given a KeyValues object and a key name, set associated bool value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptSetKeyValueString , " SetKeyString " , " Given a KeyValues object and a key name, set associated string value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptSetName , " SetName " , " Given a KeyValues object, set its name " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptSetInt , " SetInt " , " Given a KeyValues object, set its own associated integer value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptSetFloat , " SetFloat " , " Given a KeyValues object, set its own associated float value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptSetBool , " SetBool " , " Given a KeyValues object, set its own associated bool value " ) ;
DEFINE_SCRIPTFUNC_NAMED ( ScriptSetString , " SetString " , " Given a KeyValues object, set its own associated string value " ) ;
# endif
2020-05-04 16:25:15 +10:00
END_SCRIPTDESC ( ) ;
HSCRIPT CScriptKeyValues : : ScriptFindKey ( const char * pszName )
{
KeyValues * pKeyValues = m_pKeyValues - > FindKey ( pszName ) ;
if ( pKeyValues = = NULL )
return NULL ;
CScriptKeyValues * pScriptKey = new CScriptKeyValues ( pKeyValues ) ;
// UNDONE: who calls ReleaseInstance on this??
HSCRIPT hScriptInstance = g_pScriptVM - > RegisterInstance ( pScriptKey ) ;
return hScriptInstance ;
}
HSCRIPT CScriptKeyValues : : ScriptGetFirstSubKey ( void )
{
KeyValues * pKeyValues = m_pKeyValues - > GetFirstSubKey ( ) ;
if ( pKeyValues = = NULL )
return NULL ;
CScriptKeyValues * pScriptKey = new CScriptKeyValues ( pKeyValues ) ;
// UNDONE: who calls ReleaseInstance on this??
HSCRIPT hScriptInstance = g_pScriptVM - > RegisterInstance ( pScriptKey ) ;
return hScriptInstance ;
}
HSCRIPT CScriptKeyValues : : ScriptGetNextKey ( void )
{
KeyValues * pKeyValues = m_pKeyValues - > GetNextKey ( ) ;
if ( pKeyValues = = NULL )
return NULL ;
CScriptKeyValues * pScriptKey = new CScriptKeyValues ( pKeyValues ) ;
// UNDONE: who calls ReleaseInstance on this??
HSCRIPT hScriptInstance = g_pScriptVM - > RegisterInstance ( pScriptKey ) ;
return hScriptInstance ;
}
int CScriptKeyValues : : ScriptGetKeyValueInt ( const char * pszName )
{
int i = m_pKeyValues - > GetInt ( pszName ) ;
return i ;
}
float CScriptKeyValues : : ScriptGetKeyValueFloat ( const char * pszName )
{
float f = m_pKeyValues - > GetFloat ( pszName ) ;
return f ;
}
const char * CScriptKeyValues : : ScriptGetKeyValueString ( const char * pszName )
{
const char * psz = m_pKeyValues - > GetString ( pszName ) ;
return psz ;
}
bool CScriptKeyValues : : ScriptIsKeyValueEmpty ( const char * pszName )
{
bool b = m_pKeyValues - > IsEmpty ( pszName ) ;
return b ;
}
bool CScriptKeyValues : : ScriptGetKeyValueBool ( const char * pszName )
{
bool b = m_pKeyValues - > GetBool ( pszName ) ;
return b ;
}
void CScriptKeyValues : : ScriptReleaseKeyValues ( )
{
m_pKeyValues - > deleteThis ( ) ;
m_pKeyValues = NULL ;
}
2020-05-22 20:26:31 -05:00
# ifdef MAPBASE_VSCRIPT
const char * CScriptKeyValues : : ScriptGetName ( )
{
const char * psz = m_pKeyValues - > GetName ( ) ;
return psz ;
}
int CScriptKeyValues : : ScriptGetInt ( )
{
int i = m_pKeyValues - > GetInt ( ) ;
return i ;
}
float CScriptKeyValues : : ScriptGetFloat ( )
{
float f = m_pKeyValues - > GetFloat ( ) ;
return f ;
}
const char * CScriptKeyValues : : ScriptGetString ( )
{
const char * psz = m_pKeyValues - > GetString ( ) ;
return psz ;
}
bool CScriptKeyValues : : ScriptGetBool ( )
{
bool b = m_pKeyValues - > GetBool ( ) ;
return b ;
}
void CScriptKeyValues : : ScriptSetKeyValueInt ( const char * pszName , int iValue )
{
m_pKeyValues - > SetInt ( pszName , iValue ) ;
}
void CScriptKeyValues : : ScriptSetKeyValueFloat ( const char * pszName , float flValue )
{
m_pKeyValues - > SetFloat ( pszName , flValue ) ;
}
void CScriptKeyValues : : ScriptSetKeyValueString ( const char * pszName , const char * pszValue )
{
m_pKeyValues - > SetString ( pszName , pszValue ) ;
}
void CScriptKeyValues : : ScriptSetKeyValueBool ( const char * pszName , bool bValue )
{
m_pKeyValues - > SetBool ( pszName , bValue ) ;
}
void CScriptKeyValues : : ScriptSetName ( const char * pszValue )
{
m_pKeyValues - > SetName ( pszValue ) ;
}
void CScriptKeyValues : : ScriptSetInt ( int iValue )
{
m_pKeyValues - > SetInt ( NULL , iValue ) ;
}
void CScriptKeyValues : : ScriptSetFloat ( float flValue )
{
m_pKeyValues - > SetFloat ( NULL , flValue ) ;
}
void CScriptKeyValues : : ScriptSetString ( const char * pszValue )
{
m_pKeyValues - > SetString ( NULL , pszValue ) ;
}
void CScriptKeyValues : : ScriptSetBool ( bool bValue )
{
m_pKeyValues - > SetBool ( NULL , bValue ) ;
}
# endif
2020-05-04 16:25:15 +10:00
// constructors
CScriptKeyValues : : CScriptKeyValues ( KeyValues * pKeyValues = NULL )
{
m_pKeyValues = pKeyValues ;
}
// destructor
CScriptKeyValues : : ~ CScriptKeyValues ( )
{
if ( m_pKeyValues )
{
m_pKeyValues - > deleteThis ( ) ;
}
m_pKeyValues = NULL ;
}
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
2020-08-30 15:58:34 +03:00
# ifdef MAPBASE_VSCRIPT
# define RETURN_IF_CANNOT_DRAW_OVERLAY\
if ( engine - > IsPaused ( ) ) \
{ \
2020-08-31 22:01:58 +03:00
DevWarning ( " debugoverlay: cannot draw while the game is paused! \n " ) ; \
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
2020-08-30 15:58:34 +03:00
return ; \
2020-09-01 20:19:08 +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
2020-08-30 15:58:34 +03:00
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
2020-09-01 20:19:08 +03:00
if ( debugoverlay )
{
debugoverlay - > AddBoxOverlay ( origin , mins , maxs , vec3_angle , r , g , b , a , flDuration ) ;
}
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
2020-08-30 15:58:34 +03:00
}
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 ) ;
2020-09-01 20:19:08 +03:00
if ( debugoverlay )
{
debugoverlay - > AddBoxOverlay ( origin , mins , maxs , f_angles , r , g , b , a , flDuration ) ;
}
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
2020-08-30 15:58:34 +03:00
}
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
2020-09-01 20:19:08 +03:00
if ( debugoverlay )
{
debugoverlay - > AddBoxOverlay ( origin , mins , maxs , angles , r , g , b , a , flDuration ) ;
}
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
2020-08-30 15:58:34 +03:00
}
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
2020-09-01 20:19:08 +03:00
if ( debugoverlay )
{
debugoverlay - > AddSweptBoxOverlay ( start , end , mins , maxs , angles , r , g , b , a , flDuration ) ;
}
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
2020-08-30 15:58:34 +03:00
}
void EntityBounds ( HSCRIPT pEntity , int r , int g , int b , int a , float flDuration )
{
RETURN_IF_CANNOT_DRAW_OVERLAY
2020-09-01 20:19:08 +03:00
CBaseEntity * pEnt = ToEnt ( pEntity ) ;
if ( ! pEnt )
return ;
const CCollisionProperty * pCollide = pEnt - > CollisionProp ( ) ;
if ( debugoverlay )
{
debugoverlay - > AddBoxOverlay ( pCollide - > GetCollisionOrigin ( ) , pCollide - > OBBMins ( ) , pCollide - > OBBMaxs ( ) , pCollide - > GetCollisionAngles ( ) , r , g , b , a , flDuration ) ;
}
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
2020-08-30 15:58:34 +03:00
}
void Line ( const Vector & origin , const Vector & target , int r , int g , int b , bool noDepthTest , float flDuration )
{
RETURN_IF_CANNOT_DRAW_OVERLAY
2020-09-01 20:19:08 +03:00
if ( debugoverlay )
{
debugoverlay - > AddLineOverlay ( origin , target , r , g , b , noDepthTest , flDuration ) ;
}
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
2020-08-30 15:58:34 +03:00
}
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
2020-09-01 20:19:08 +03:00
if ( debugoverlay )
{
debugoverlay - > AddTriangleOverlay ( p1 , p2 , p3 , r , g , b , a , noDepthTest , duration ) ;
}
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
2020-08-30 15:58:34 +03:00
}
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
2020-09-01 20:19:08 +03:00
if ( debugoverlay )
{
debugoverlay - > AddEntityTextOverlay ( entityID , text_offset , flDuration ,
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
2020-08-30 15:58:34 +03:00
( 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 ) ;
2020-09-01 20:19:08 +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
2020-08-30 15:58:34 +03:00
}
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
2020-09-01 20:19:08 +03:00
if ( debugoverlay )
{
debugoverlay - > AddTextOverlayRGB ( origin , text_offset , flDuration , r , g , b , a , " %s " , text ) ;
}
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
2020-08-30 15:58:34 +03:00
}
void Grid ( const Vector & vPosition )
{
RETURN_IF_CANNOT_DRAW_OVERLAY
2020-09-01 20:19:08 +03:00
if ( debugoverlay )
{
debugoverlay - > AddGridOverlay ( vPosition ) ;
}
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
2020-08-30 15:58:34 +03:00
}
void Text ( const Vector & origin , const char * text , float flDuration )
{
RETURN_IF_CANNOT_DRAW_OVERLAY
2020-09-01 20:19:08 +03:00
if ( debugoverlay )
{
debugoverlay - > AddTextOverlay ( origin , flDuration , " %s " , text ) ;
}
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
2020-08-30 15:58:34 +03:00
}
void ScreenText ( float fXpos , float fYpos , const char * text , int r , int g , int b , int a , float flDuration )
{
RETURN_IF_CANNOT_DRAW_OVERLAY
2020-05-04 16:25:15 +10:00
2020-09-01 20:19:08 +03:00
if ( debugoverlay )
{
debugoverlay - > AddScreenTextOverlay ( fXpos , fYpos , flDuration , r , g , b , a , text ) ;
}
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
2020-08-30 15:58:34 +03:00
}
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 ) ;
2020-09-01 20:19:08 +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
2020-08-30 15:58:34 +03:00
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 & center , 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 ) ;
}
}
}
2020-09-01 20:19:08 +03:00
void SetDebugBits ( HSCRIPT hEntity , int bit ) // DebugOverlayBits_t
{
CBaseEntity * pEnt = ToEnt ( hEntity ) ;
if ( ! pEnt )
return ;
if ( pEnt - > m_debugOverlays & bit )
{
pEnt - > m_debugOverlays & = ~ bit ;
}
else
{
pEnt - > m_debugOverlays | = bit ;
# ifdef AI_MONITOR_FOR_OSCILLATION
if ( pEnt - > IsNPC ( ) )
{
pEnt - > MyNPCPointer ( ) - > m_ScheduleHistory . RemoveAll ( ) ;
}
# endif //AI_MONITOR_FOR_OSCILLATION
}
}
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
2020-08-30 15:58:34 +03:00
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 " )
2020-09-01 20:19:08 +03:00
DEFINE_SCRIPTFUNC ( Box , " Draws a world-space axis-aligned box. Specify bounds in world space. " )
DEFINE_SCRIPTFUNC ( BoxDirection , " Draw box oriented to a Vector direction " )
DEFINE_SCRIPTFUNC ( BoxAngles , " Draws an oriented box at the origin. Specify bounds in local space. " )
DEFINE_SCRIPTFUNC ( SweptBox , " Draws a swept box. Specify endpoints in world space and the bounds in local space. " )
DEFINE_SCRIPTFUNC ( EntityBounds , " Draws bounds of an entity " )
DEFINE_SCRIPTFUNC ( Line , " Draws a line between two points " )
DEFINE_SCRIPTFUNC ( Triangle , " Draws a filled triangle. Specify vertices in world space. " )
DEFINE_SCRIPTFUNC ( EntityText , " Draws text on an entity " )
DEFINE_SCRIPTFUNC ( EntityTextAtPosition , " Draw entity text overlay at a specific position " )
DEFINE_SCRIPTFUNC ( Grid , " Add grid overlay " )
DEFINE_SCRIPTFUNC ( Text , " Draws 2D text. Specify origin in world space. " )
DEFINE_SCRIPTFUNC ( ScreenText , " Draws 2D text. Specify coordinates in screen space. " )
DEFINE_SCRIPTFUNC ( Cross3D , " Draws a world-aligned cross. Specify origin in world space. " )
DEFINE_SCRIPTFUNC ( Cross3DOriented , " Draws an oriented cross. Specify origin in world space. " )
DEFINE_SCRIPTFUNC ( DrawTickMarkedLine , " Draws a dashed line. Specify endpoints in world space. " )
DEFINE_SCRIPTFUNC ( HorzArrow , " Draws a horizontal arrow. Specify endpoints in world space. " )
DEFINE_SCRIPTFUNC ( YawArrow , " Draws a arrow associated with a specific yaw. Specify endpoints in world space. " )
DEFINE_SCRIPTFUNC ( VertArrow , " Draws a vertical arrow. Specify endpoints in world space. " )
DEFINE_SCRIPTFUNC ( Axis , " Draws an axis. Specify origin + orientation in world space. " )
DEFINE_SCRIPTFUNC ( Sphere , " Draws a wireframe sphere. Specify center in world space. " )
DEFINE_SCRIPTFUNC ( CircleOriented , " Draws a circle oriented. Specify center in world space. " )
DEFINE_SCRIPTFUNC ( Circle , " Draws a circle. Specify center in world space. " )
DEFINE_SCRIPTFUNC ( SetDebugBits , " Set debug bits on entity " )
DEFINE_SCRIPTFUNC ( ClearAllOverlays , " Clear all debug overlays at once " )
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
2020-08-30 15:58:34 +03:00
END_SCRIPTDESC ( ) ;
# endif // MAPBASE_VSCRIPT
2020-05-04 16:25:15 +10:00
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
static float Time ( )
{
return gpGlobals - > curtime ;
}
static float FrameTime ( )
{
return gpGlobals - > frametime ;
}
2020-06-11 23:30:22 -05:00
# ifdef MAPBASE_VSCRIPT
static int MaxPlayers ( )
{
return gpGlobals - > maxClients ;
}
static float IntervalPerTick ( )
{
return gpGlobals - > interval_per_tick ;
}
# endif
2020-05-04 16:25:15 +10:00
static void SendToConsole ( const char * pszCommand )
{
CBasePlayer * pPlayer = UTIL_GetLocalPlayerOrListenServerHost ( ) ;
if ( ! pPlayer )
{
DevMsg ( " Cannot execute \" %s \" , no player \n " , pszCommand ) ;
return ;
}
engine - > ClientCommand ( pPlayer - > edict ( ) , pszCommand ) ;
}
static const char * GetMapName ( )
{
return STRING ( gpGlobals - > mapname ) ;
}
static const char * DoUniqueString ( const char * pszBase )
{
static char szBuf [ 512 ] ;
g_pScriptVM - > GenerateUniqueKey ( pszBase , szBuf , ARRAYSIZE ( szBuf ) ) ;
return szBuf ;
}
static void DoEntFire ( const char * pszTarget , const char * pszAction , const char * pszValue , float delay , HSCRIPT hActivator , HSCRIPT hCaller )
{
const char * target = " " , * action = " Use " ;
variant_t value ;
target = STRING ( AllocPooledString ( pszTarget ) ) ;
// Don't allow them to run anything on a point_servercommand unless they're the host player. Otherwise they can ent_fire
// and run any command on the server. Admittedly, they can only do the ent_fire if sv_cheats is on, but
// people complained about users resetting the rcon password if the server briefly turned on cheats like this:
// give point_servercommand
// ent_fire point_servercommand command "rcon_password mynewpassword"
if ( gpGlobals - > maxClients > 1 & & V_stricmp ( target , " point_servercommand " ) = = 0 )
{
return ;
}
if ( * pszAction )
{
action = STRING ( AllocPooledString ( pszAction ) ) ;
}
if ( * pszValue )
{
value . SetString ( AllocPooledString ( pszValue ) ) ;
}
if ( delay < 0 )
{
delay = 0 ;
}
g_EventQueue . AddEvent ( target , action , value , delay , ToEnt ( hActivator ) , ToEnt ( hCaller ) ) ;
}
bool DoIncludeScript ( const char * pszScript , HSCRIPT hScope )
{
if ( ! VScriptRunScript ( pszScript , hScope , true ) )
{
g_pScriptVM - > RaiseException ( CFmtStr ( " Failed to include script \" %s \" " , ( pszScript ) ? pszScript : " unknown " ) ) ;
return false ;
}
return true ;
}
HSCRIPT CreateProp ( const char * pszEntityName , const Vector & vOrigin , const char * pszModelName , int iAnim )
{
CBaseAnimating * pBaseEntity = ( CBaseAnimating * ) CreateEntityByName ( pszEntityName ) ;
pBaseEntity - > SetAbsOrigin ( vOrigin ) ;
pBaseEntity - > SetModel ( pszModelName ) ;
pBaseEntity - > SetPlaybackRate ( 1.0f ) ;
int iSequence = pBaseEntity - > SelectWeightedSequence ( ( Activity ) iAnim ) ;
if ( iSequence ! = - 1 )
{
pBaseEntity - > SetSequence ( iSequence ) ;
}
return ToHScript ( pBaseEntity ) ;
}
//--------------------------------------------------------------------------------------------------
// Use an entity's script instance to add an entity IO event (used for firing events on unnamed entities from vscript)
//--------------------------------------------------------------------------------------------------
static void DoEntFireByInstanceHandle ( HSCRIPT hTarget , const char * pszAction , const char * pszValue , float delay , HSCRIPT hActivator , HSCRIPT hCaller )
{
const char * action = " Use " ;
variant_t value ;
if ( * pszAction )
{
action = STRING ( AllocPooledString ( pszAction ) ) ;
}
if ( * pszValue )
{
value . SetString ( AllocPooledString ( pszValue ) ) ;
}
if ( delay < 0 )
{
delay = 0 ;
}
CBaseEntity * pTarget = ToEnt ( hTarget ) ;
if ( ! pTarget )
{
Warning ( " VScript error: DoEntFire was passed an invalid entity instance. \n " ) ;
return ;
}
g_EventQueue . AddEvent ( pTarget , action , value , delay , ToEnt ( hActivator ) , ToEnt ( hCaller ) ) ;
}
static float ScriptTraceLine ( const Vector & vecStart , const Vector & vecEnd , HSCRIPT entIgnore )
{
// UTIL_TraceLine( vecAbsStart, vecAbsEnd, MASK_BLOCKLOS, pLooker, COLLISION_GROUP_NONE, ptr );
trace_t tr ;
CBaseEntity * pLooker = ToEnt ( entIgnore ) ;
UTIL_TraceLine ( vecStart , vecEnd , MASK_NPCWORLDSTATIC , pLooker , COLLISION_GROUP_NONE , & tr ) ;
if ( tr . fractionleftsolid & & tr . startsolid )
{
return 1.0 - tr . fractionleftsolid ;
}
else
{
return tr . fraction ;
}
}
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
2020-08-30 15:58:34 +03:00
# ifdef MAPBASE_VSCRIPT
//-----------------------------------------------------------------------------
// Simple particle effect dispatch
//-----------------------------------------------------------------------------
static void ScriptDispatchParticleEffect ( const char * pszParticleName , const Vector & vecOrigin , const QAngle & vecAngles )
{
DispatchParticleEffect ( pszParticleName , vecOrigin , vecAngles ) ;
}
# endif
2020-05-04 16:25:15 +10:00
bool VScriptServerInit ( )
{
VMPROF_START
if ( scriptmanager ! = NULL )
{
ScriptLanguage_t scriptLanguage = SL_DEFAULT ;
char const * pszScriptLanguage ;
2020-05-27 10:22:45 -05:00
# ifdef MAPBASE_VSCRIPT
if ( GetWorldEntity ( ) - > GetScriptLanguage ( ) ! = SL_NONE )
{
// Allow world entity to override script language
scriptLanguage = GetWorldEntity ( ) - > GetScriptLanguage ( ) ;
2020-07-16 15:43:30 +00:00
// Less than SL_NONE means the script language should literally be none
if ( scriptLanguage < SL_NONE )
scriptLanguage = SL_NONE ;
2020-05-27 10:22:45 -05:00
}
else
# endif
2020-05-04 16:25:15 +10:00
if ( CommandLine ( ) - > CheckParm ( " -scriptlang " , & pszScriptLanguage ) )
{
if ( ! Q_stricmp ( pszScriptLanguage , " gamemonkey " ) )
{
scriptLanguage = SL_GAMEMONKEY ;
}
else if ( ! Q_stricmp ( pszScriptLanguage , " squirrel " ) )
{
scriptLanguage = SL_SQUIRREL ;
}
else if ( ! Q_stricmp ( pszScriptLanguage , " python " ) )
{
scriptLanguage = SL_PYTHON ;
}
2020-05-27 10:22:45 -05:00
# ifdef MAPBASE_VSCRIPT
else if ( ! Q_stricmp ( pszScriptLanguage , " lua " ) )
{
scriptLanguage = SL_LUA ;
}
# endif
2020-05-04 16:25:15 +10:00
else
{
DevWarning ( " -server_script does not recognize a language named '%s'. virtual machine did NOT start. \n " , pszScriptLanguage ) ;
scriptLanguage = SL_NONE ;
}
}
if ( scriptLanguage ! = SL_NONE )
{
if ( g_pScriptVM = = NULL )
g_pScriptVM = scriptmanager - > CreateVM ( scriptLanguage ) ;
if ( g_pScriptVM )
{
2020-07-16 15:43:30 +00:00
# ifdef MAPBASE_VSCRIPT
Log ( " VSCRIPT SERVER: Started VScript virtual machine using script language '%s' \n " , g_pScriptVM - > GetLanguageName ( ) ) ;
# else
2020-05-04 16:25:15 +10:00
Log ( " VSCRIPT: Started VScript virtual machine using script language '%s' \n " , g_pScriptVM - > GetLanguageName ( ) ) ;
2020-07-16 15:43:30 +00:00
# endif
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
2020-08-30 15:58:34 +03:00
2020-05-04 16:25:15 +10:00
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 " ) ;
ScriptRegisterFunction ( g_pScriptVM , GetMapName , " Get the name of the map. " ) ;
ScriptRegisterFunctionNamed ( g_pScriptVM , ScriptTraceLine , " TraceLine " , " given 2 points & ent to ignore, return fraction along line that hits world or models " ) ;
ScriptRegisterFunction ( g_pScriptVM , Time , " Get the current server time " ) ;
ScriptRegisterFunction ( g_pScriptVM , FrameTime , " Get the time spent on the server in the last frame " ) ;
2020-06-11 23:30:22 -05:00
# ifdef MAPBASE_VSCRIPT
ScriptRegisterFunction ( g_pScriptVM , MaxPlayers , " Get the maximum number of players allowed on this server " ) ;
ScriptRegisterFunction ( g_pScriptVM , IntervalPerTick , " Get the interval used between each tick " ) ;
2020-06-13 12:44:40 -05:00
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. " ) ) ;
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
2020-08-30 15:58:34 +03:00
// ScriptRegisterFunction( g_pScriptVM, IsValidEntity, "Returns true if the entity is valid." );
2020-06-13 12:44:40 -05:00
# else
2020-05-04 16:25:15 +10:00
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. " ) ;
2020-06-13 12:44:40 -05:00
# endif
2020-05-04 16:25:15 +10:00
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. " ) ;
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
2020-08-30 15:58:34 +03:00
# ifndef MAPBASE_VSCRIPT
2020-05-04 16:25:15 +10:00
ScriptRegisterFunctionNamed ( g_pScriptVM , NDebugOverlay : : Box , " DebugDrawBox " , " Draw a debug overlay box " ) ;
ScriptRegisterFunctionNamed ( g_pScriptVM , NDebugOverlay : : Line , " DebugDrawLine " , " Draw a debug overlay box " ) ;
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
2020-08-30 15:58:34 +03:00
# endif
2020-05-04 16:25:15 +10:00
ScriptRegisterFunction ( g_pScriptVM , DoIncludeScript , " Execute a script (internal) " ) ;
ScriptRegisterFunction ( g_pScriptVM , CreateProp , " Create a physics prop " ) ;
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
2020-08-30 15:58:34 +03:00
# ifdef MAPBASE_VSCRIPT
ScriptRegisterFunctionNamed ( g_pScriptVM , ScriptDispatchParticleEffect , " DispatchParticleEffect " , " Dispatches a one-off particle system " ) ;
# endif
2020-05-04 16:25:15 +10:00
if ( GameRules ( ) )
{
GameRules ( ) - > RegisterScriptFunctions ( ) ;
}
g_pScriptVM - > RegisterInstance ( & g_ScriptEntityIterator , " Entities " ) ;
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
2020-08-30 15:58:34 +03:00
# ifdef MAPBASE_VSCRIPT
g_pScriptVM - > RegisterInstance ( & g_ScriptDebugOverlay , " debugoverlay " ) ;
# endif
2020-05-04 16:25:15 +10:00
2020-05-22 20:26:31 -05:00
# ifdef MAPBASE_VSCRIPT
2020-07-12 11:46:43 +10:00
g_pScriptVM - > RegisterAllClasses ( ) ;
Mapbase v5.0
- Added keyvalue to hl2_gamerules which allows respawning in singleplayer
- Added the game instructor system (including env_instructor_hint) from later Valve games using a VDC tutorial which adjusts the version from the Alien Swarm SDK to FPS rules and a Source 2013 environment; Also added new KV and icons for further control from mappers (tutorial mentioned by Maestra Fenix)
- Added L4D/TF2 glows + point_glow entity as an all-purpose SDK-based off-shoot of tf_glow
- Fixed weapon pickup sound not playing (reported by Sl0th and later Cvoxulary)
- Fixed env_projectedtextures not updating on save/load
- Added func_fake_worldportal, a spatial point_camera inspired by linked_portal_door based on SDK code alone (WIP, may be changed a lot in future updates)
- Added option for point_camera and func_reflective_glass to use different render targets, therefore allowing multiple cameras and mirrors to be active at the same time
- Added additional RT camera textures to choose from with a default of 3, but also controllable through a -numcameratextures command line param
- Added adjustable convars for main view NearZ and skybox NearZ (suggested by someone recently, also suggested by Klems over a year ago)
- Fixed map-specific localization files, cleaned up map-specific file code
- Added a new block to gameinfo.txt which allows mods to automatically append their own command line parameters
- Fixed math_lightpattern corruption when setting pattern/style while active
- Fixed the "Touch" input crashing when given no entity
- Added a way to add EFlags via keyvalue (suggested by Niker107)
- Fixed ai_script_conditions not working without a NPC actor (reported by MetroHam)
- Fixed point_radiation_source causing huge problems when intensity is 0, even though it was already advised against (reported by beefbacon)
- Added "Mapbase" header to Mapbase-specific code files
- Fixed an issue with updating sky_camera not obtaining area correctly, causing some entities to not draw in the skybox
- Added "CopyFogController" and "CopyFogControllerWithScale" inputs to sky_camera, which copy fog parameters directly from a fog controller
- Added "SetScale" input to sky_camera for live scale changing
- Added convar to control player crouch speed multiplier (suggested by ArtyIF)
- Added a ton of fixes for people running the Debug configuration of the codebase (partial credit to stepa2)
- Added support for pre-defined enums and constants in VScript, starting with various values from the SDK code (damage types, trace masks, etc.)
- Added limited support for Valve's Quaternion class in VScript
- Added new instance helper capabilities, destructible game instances, and other misc. changes to VScript library
- Replaced most of the VScript "accessor" classes with direct references to the original classes, as they were getting complicated fast and adding new VScript-only functions to the original classes might not be as bad as previously thought
- Added base NPC hooks for AI sensing in VScript (allows control over sight and hearing), also exposed CSound for it
- Added various functions and hooks for VPhysics integration in VScript
- Added VScript-based custom suit devices
- Expanded trace info exposed to VScript to allow plane and surface access (suggested by krassell)
- Added ability to insert localization strings through VScript
- Added various misc. VScript functions with various purposes, including reading/writing EFlags, movetypes, collision groups, etc.
- Fixed VBSP not being able to correctly parse parallax corrected cubemaps in maps with instances
2020-08-14 21:21:25 +00:00
g_pScriptVM - > RegisterAllEnums ( ) ;
2020-07-12 11:46:43 +10:00
2020-05-22 20:26:31 -05:00
IGameSystem : : RegisterVScriptAllSystems ( ) ;
Mapbase v5.0
- Added keyvalue to hl2_gamerules which allows respawning in singleplayer
- Added the game instructor system (including env_instructor_hint) from later Valve games using a VDC tutorial which adjusts the version from the Alien Swarm SDK to FPS rules and a Source 2013 environment; Also added new KV and icons for further control from mappers (tutorial mentioned by Maestra Fenix)
- Added L4D/TF2 glows + point_glow entity as an all-purpose SDK-based off-shoot of tf_glow
- Fixed weapon pickup sound not playing (reported by Sl0th and later Cvoxulary)
- Fixed env_projectedtextures not updating on save/load
- Added func_fake_worldportal, a spatial point_camera inspired by linked_portal_door based on SDK code alone (WIP, may be changed a lot in future updates)
- Added option for point_camera and func_reflective_glass to use different render targets, therefore allowing multiple cameras and mirrors to be active at the same time
- Added additional RT camera textures to choose from with a default of 3, but also controllable through a -numcameratextures command line param
- Added adjustable convars for main view NearZ and skybox NearZ (suggested by someone recently, also suggested by Klems over a year ago)
- Fixed map-specific localization files, cleaned up map-specific file code
- Added a new block to gameinfo.txt which allows mods to automatically append their own command line parameters
- Fixed math_lightpattern corruption when setting pattern/style while active
- Fixed the "Touch" input crashing when given no entity
- Added a way to add EFlags via keyvalue (suggested by Niker107)
- Fixed ai_script_conditions not working without a NPC actor (reported by MetroHam)
- Fixed point_radiation_source causing huge problems when intensity is 0, even though it was already advised against (reported by beefbacon)
- Added "Mapbase" header to Mapbase-specific code files
- Fixed an issue with updating sky_camera not obtaining area correctly, causing some entities to not draw in the skybox
- Added "CopyFogController" and "CopyFogControllerWithScale" inputs to sky_camera, which copy fog parameters directly from a fog controller
- Added "SetScale" input to sky_camera for live scale changing
- Added convar to control player crouch speed multiplier (suggested by ArtyIF)
- Added a ton of fixes for people running the Debug configuration of the codebase (partial credit to stepa2)
- Added support for pre-defined enums and constants in VScript, starting with various values from the SDK code (damage types, trace masks, etc.)
- Added limited support for Valve's Quaternion class in VScript
- Added new instance helper capabilities, destructible game instances, and other misc. changes to VScript library
- Replaced most of the VScript "accessor" classes with direct references to the original classes, as they were getting complicated fast and adding new VScript-only functions to the original classes might not be as bad as previously thought
- Added base NPC hooks for AI sensing in VScript (allows control over sight and hearing), also exposed CSound for it
- Added various functions and hooks for VPhysics integration in VScript
- Added VScript-based custom suit devices
- Expanded trace info exposed to VScript to allow plane and surface access (suggested by krassell)
- Added ability to insert localization strings through VScript
- Added various misc. VScript functions with various purposes, including reading/writing EFlags, movetypes, collision groups, etc.
- Fixed VBSP not being able to correctly parse parallax corrected cubemaps in maps with instances
2020-08-14 21:21:25 +00:00
RegisterSharedScriptConstants ( ) ;
2020-05-22 20:26:31 -05:00
RegisterSharedScriptFunctions ( ) ;
2020-05-31 15:39:17 +10:00
# endif
if ( scriptLanguage = = SL_SQUIRREL )
2020-05-04 16:25:15 +10:00
{
2020-05-31 15:39:17 +10:00
g_pScriptVM - > Run ( g_Script_vscript_server ) ;
2020-05-04 16:25:15 +10:00
}
VScriptRunScript ( " mapspawn " , false ) ;
VMPROF_SHOW ( pszScriptLanguage , " virtual machine startup " ) ;
return true ;
}
else
{
DevWarning ( " VM Did not start! \n " ) ;
}
}
}
else
{
Log ( " \n VSCRIPT: Scripting is disabled. \n " ) ;
}
g_pScriptVM = NULL ;
return false ;
}
void VScriptServerTerm ( )
{
if ( g_pScriptVM ! = NULL )
{
if ( g_pScriptVM )
{
scriptmanager - > DestroyVM ( g_pScriptVM ) ;
g_pScriptVM = NULL ;
}
}
}
bool VScriptServerReplaceClosures ( const char * pszScriptName , HSCRIPT hScope , bool bWarnMissing )
{
if ( ! g_pScriptVM )
{
return false ;
}
HSCRIPT hReplaceClosuresFunc = g_pScriptVM - > LookupFunction ( " __ReplaceClosures " ) ;
if ( ! hReplaceClosuresFunc )
{
return false ;
}
HSCRIPT hNewScript = VScriptCompileScript ( pszScriptName , bWarnMissing ) ;
if ( ! hNewScript )
{
return false ;
}
g_pScriptVM - > Call ( hReplaceClosuresFunc , NULL , true , NULL , hNewScript , hScope ) ;
return true ;
}
CON_COMMAND ( script_reload_code , " Execute a vscript file, replacing existing functions with the functions in the run script " )
{
if ( ! * args [ 1 ] )
{
Warning ( " No script specified \n " ) ;
return ;
}
if ( ! g_pScriptVM )
{
Warning ( " Scripting disabled or no server running \n " ) ;
return ;
}
VScriptServerReplaceClosures ( args [ 1 ] , NULL , true ) ;
}
CON_COMMAND ( script_reload_entity_code , " Execute all of this entity's VScripts, replacing existing functions with the functions in the run scripts " )
{
extern CBaseEntity * GetNextCommandEntity ( CBasePlayer * pPlayer , const char * name , CBaseEntity * ent ) ;
const char * pszTarget = " " ;
if ( * args [ 1 ] )
{
pszTarget = args [ 1 ] ;
}
if ( ! g_pScriptVM )
{
Warning ( " Scripting disabled or no server running \n " ) ;
return ;
}
CBasePlayer * pPlayer = UTIL_GetCommandClient ( ) ;
if ( ! pPlayer )
return ;
CBaseEntity * pEntity = NULL ;
while ( ( pEntity = GetNextCommandEntity ( pPlayer , pszTarget , pEntity ) ) ! = NULL )
{
if ( pEntity - > m_ScriptScope . IsInitialized ( ) & & pEntity - > m_iszVScripts ! = NULL_STRING )
{
char szScriptsList [ 255 ] ;
Q_strcpy ( szScriptsList , STRING ( pEntity - > m_iszVScripts ) ) ;
CUtlStringList szScripts ;
V_SplitString ( szScriptsList , " " , szScripts ) ;
for ( int i = 0 ; i < szScripts . Count ( ) ; i + + )
{
VScriptServerReplaceClosures ( szScripts [ i ] , pEntity - > m_ScriptScope , true ) ;
}
}
}
}
CON_COMMAND ( script_reload_think , " Execute an activation script, replacing existing functions with the functions in the run script " )
{
extern CBaseEntity * GetNextCommandEntity ( CBasePlayer * pPlayer , const char * name , CBaseEntity * ent ) ;
const char * pszTarget = " " ;
if ( * args [ 1 ] )
{
pszTarget = args [ 1 ] ;
}
if ( ! g_pScriptVM )
{
Warning ( " Scripting disabled or no server running \n " ) ;
return ;
}
CBasePlayer * pPlayer = UTIL_GetCommandClient ( ) ;
if ( ! pPlayer )
return ;
CBaseEntity * pEntity = NULL ;
while ( ( pEntity = GetNextCommandEntity ( pPlayer , pszTarget , pEntity ) ) ! = NULL )
{
if ( pEntity - > m_ScriptScope . IsInitialized ( ) & & pEntity - > m_iszScriptThinkFunction ! = NULL_STRING )
{
VScriptServerReplaceClosures ( STRING ( pEntity - > m_iszScriptThinkFunction ) , pEntity - > m_ScriptScope , true ) ;
}
}
}
class CVScriptGameSystem : public CAutoGameSystemPerFrame
{
public :
// Inherited from IAutoServerSystem
virtual void LevelInitPreEntity ( void )
{
m_bAllowEntityCreationInScripts = true ;
VScriptServerInit ( ) ;
}
virtual void LevelInitPostEntity ( void )
{
m_bAllowEntityCreationInScripts = false ;
}
virtual void LevelShutdownPostEntity ( void )
{
VScriptServerTerm ( ) ;
}
virtual void FrameUpdatePostEntityThink ( )
{
if ( g_pScriptVM )
g_pScriptVM - > Frame ( gpGlobals - > frametime ) ;
}
bool m_bAllowEntityCreationInScripts ;
} ;
CVScriptGameSystem g_VScriptGameSystem ;
2020-05-27 10:22:45 -05:00
# ifdef MAPBASE_VSCRIPT
ConVar script_allow_entity_creation_midgame ( " script_allow_entity_creation_midgame " , " 1 " , FCVAR_NOT_CONNECTED , " Allows VScript files to create entities mid-game, as opposed to only creating entities on startup. " ) ;
# endif
2020-05-04 16:25:15 +10:00
bool IsEntityCreationAllowedInScripts ( void )
{
2020-05-27 10:22:45 -05:00
# ifdef MAPBASE_VSCRIPT
if ( script_allow_entity_creation_midgame . GetBool ( ) )
return true ;
# endif
2020-05-04 16:25:15 +10:00
return g_VScriptGameSystem . m_bAllowEntityCreationInScripts ;
}
static short VSCRIPT_SERVER_SAVE_RESTORE_VERSION = 2 ;
//-----------------------------------------------------------------------------
class CVScriptSaveRestoreBlockHandler : public CDefSaveRestoreBlockHandler
{
public :
CVScriptSaveRestoreBlockHandler ( ) :
m_InstanceMap ( DefLessFunc ( const char * ) )
{
}
const char * GetBlockName ( )
{
return " VScriptServer " ;
}
//---------------------------------
void Save ( ISave * pSave )
{
pSave - > StartBlock ( ) ;
int temp = g_pScriptVM ! = NULL ;
pSave - > WriteInt ( & temp ) ;
if ( g_pScriptVM )
{
temp = g_pScriptVM - > GetLanguage ( ) ;
pSave - > WriteInt ( & temp ) ;
CUtlBuffer buffer ;
g_pScriptVM - > WriteState ( & buffer ) ;
temp = buffer . TellPut ( ) ;
pSave - > WriteInt ( & temp ) ;
if ( temp > 0 )
{
pSave - > WriteData ( ( const char * ) buffer . Base ( ) , temp ) ;
}
}
pSave - > EndBlock ( ) ;
}
//---------------------------------
void WriteSaveHeaders ( ISave * pSave )
{
pSave - > WriteShort ( & VSCRIPT_SERVER_SAVE_RESTORE_VERSION ) ;
}
//---------------------------------
void ReadRestoreHeaders ( IRestore * pRestore )
{
// No reason why any future version shouldn't try to retain backward compatability. The default here is to not do so.
short version ;
pRestore - > ReadShort ( & version ) ;
m_fDoLoad = ( version = = VSCRIPT_SERVER_SAVE_RESTORE_VERSION ) ;
}
//---------------------------------
void Restore ( IRestore * pRestore , bool createPlayers )
{
if ( ! m_fDoLoad & & g_pScriptVM )
{
return ;
}
CBaseEntity * pEnt = gEntList . FirstEnt ( ) ;
while ( pEnt )
{
if ( pEnt - > m_iszScriptId ! = NULL_STRING )
{
g_pScriptVM - > RegisterClass ( pEnt - > GetScriptDesc ( ) ) ;
m_InstanceMap . Insert ( STRING ( pEnt - > m_iszScriptId ) , pEnt ) ;
}
pEnt = gEntList . NextEnt ( pEnt ) ;
}
pRestore - > StartBlock ( ) ;
if ( pRestore - > ReadInt ( ) & & pRestore - > ReadInt ( ) = = g_pScriptVM - > GetLanguage ( ) )
{
int nBytes = pRestore - > ReadInt ( ) ;
if ( nBytes > 0 )
{
CUtlBuffer buffer ;
buffer . EnsureCapacity ( nBytes ) ;
pRestore - > ReadData ( ( char * ) buffer . AccessForDirectRead ( nBytes ) , nBytes , 0 ) ;
g_pScriptVM - > ReadState ( & buffer ) ;
}
}
pRestore - > EndBlock ( ) ;
}
void PostRestore ( void )
{
for ( int i = m_InstanceMap . FirstInorder ( ) ; i ! = m_InstanceMap . InvalidIndex ( ) ; i = m_InstanceMap . NextInorder ( i ) )
{
CBaseEntity * pEnt = m_InstanceMap [ i ] ;
if ( pEnt - > m_hScriptInstance )
{
ScriptVariant_t variant ;
if ( g_pScriptVM - > GetValue ( STRING ( pEnt - > m_iszScriptId ) , & variant ) & & variant . m_type = = FIELD_HSCRIPT )
{
pEnt - > m_ScriptScope . Init ( variant . m_hScript , false ) ;
pEnt - > RunPrecacheScripts ( ) ;
}
}
else
{
// Script system probably has no internal references
pEnt - > m_iszScriptId = NULL_STRING ;
}
}
m_InstanceMap . Purge ( ) ;
}
CUtlMap < const char * , CBaseEntity * > m_InstanceMap ;
private :
bool m_fDoLoad ;
} ;
//-----------------------------------------------------------------------------
CVScriptSaveRestoreBlockHandler g_VScriptSaveRestoreBlockHandler ;
//-------------------------------------
ISaveRestoreBlockHandler * GetVScriptSaveRestoreBlockHandler ( )
{
return & g_VScriptSaveRestoreBlockHandler ;
}
//-----------------------------------------------------------------------------
bool CBaseEntityScriptInstanceHelper : : ToString ( void * p , char * pBuf , int bufSize )
{
CBaseEntity * pEntity = ( CBaseEntity * ) p ;
if ( pEntity - > GetEntityName ( ) ! = NULL_STRING )
{
V_snprintf ( pBuf , bufSize , " ([%d] %s: %s) " , pEntity - > entindex ( ) , STRING ( pEntity - > m_iClassname ) , STRING ( pEntity - > GetEntityName ( ) ) ) ;
}
else
{
V_snprintf ( pBuf , bufSize , " ([%d] %s) " , pEntity - > entindex ( ) , STRING ( pEntity - > m_iClassname ) ) ;
}
return true ;
}
void * CBaseEntityScriptInstanceHelper : : BindOnRead ( HSCRIPT hInstance , void * pOld , const char * pszId )
{
int iEntity = g_VScriptSaveRestoreBlockHandler . m_InstanceMap . Find ( pszId ) ;
if ( iEntity ! = g_VScriptSaveRestoreBlockHandler . m_InstanceMap . InvalidIndex ( ) )
{
CBaseEntity * pEnt = g_VScriptSaveRestoreBlockHandler . m_InstanceMap [ iEntity ] ;
pEnt - > m_hScriptInstance = hInstance ;
return pEnt ;
}
return NULL ;
}
CBaseEntityScriptInstanceHelper g_BaseEntityScriptInstanceHelper ;