vscript changes:

c_baseentity.h
c_baseentity.cpp
   - Renamed GetLeftVector to GetRightVector
   - Renamed GetTeamNumber to GetTeam

baseentity.h
baseentity.cpp
   - Renamed GetLeftVector to GetRightVector
   - Renamed Get/SetRender functions (GetAlpha -> GetRenderAlpha)
   - Fixed CBaseEntity::GetScriptId
   - Added hook CBaseEntity::UpdateOnRemove
   - Added CBaseEntity::GetOrCreatePrivateScriptScope
   - Added CBaseEntity::GetDebugName
   - Added CBaseEntity::GetGravity
   - Added CBaseEntity::SetGravity
   - Added CBaseEntity::GetFriction
   - Added CBaseEntity::SetFriction
   - Added CBaseEntity::GetMass
   - Added CBaseEntity::SetMass
   - Added CBaseEntity::SetName (SetNameAsCStr)
   - Added CBaseEntity::SetParent (ScriptSetParent)
   - Added CBaseEntity::SetThink (ScriptSetThink)
   - Added CBaseEntity::StopThink (ScriptStopThink)
   - Added CBaseEntity::SetThinkFunction (ScriptSetThinkFunction)
   - Added CBaseEntity::StopThinkFunction (ScriptStopThinkFunction)
   - Added CBaseEntity::ApplyAbsVelocityImpulse
   - Added CBaseEntity::ApplyLocalAngularVelocityImpulse

player.h
player.cpp
   - Renamed GetPlayerUserId to GetUserID
   - Added CBasePlayer::GetFOV
   - Added CBasePlayer::GetFOVOwner (ScriptGetFOVOwner)
   - Added CBasePlayer::SetFOV (ScriptSetFOV)

vscript_consts_shared.cpp
   -Added RAD2DEG, DEG2RAD, MAX_COORD_FLOAT, MAX_TRACE_LENGTH

vscript_funcs_shared.cpp
   - Renamed IsClientScript,IsServerScript to IsClient,IsServer
   - Added IsDedicatedServer
   - Added NPrint (Con_NPrintf)
   - Removed DebugDrawBoxDirection (debugoverlay.BoxDirection)
   - Removed DebugDrawText (debugoverlay.Text)

vscript_server.cpp
   - Added CDebugOverlayScriptHelper (debugoverlay)
   - Added CEntities::GetLocalPlayer
   - Added DispatchParticleEffect (ScriptDispatchParticleEffect)
   - Removed DebugDrawBox (debugoverlay.Box)
   - Removed DebugDrawLine (debugoverlay.Line)

vscript_squirrel.cpp
   - Changed stub error messages for consistency and clarity
   - Changed errorfunc output to Warning instead of Msg
   - Added Msg, Warning
   - Added clamp, min, max, RemapVal, RemapValClamped
   - Added sqstdtime.h
   - Added clock, time, date
This commit is contained in:
samisalreadytaken
2020-08-30 15:58:34 +03:00
parent 0087e6d734
commit 8672b7bb3f
12 changed files with 946 additions and 62 deletions

View File

@@ -118,6 +118,15 @@ void RegisterSharedScriptConstants()
// usually doing nothing sounds like a bad idea.
ScriptRegisterFunction( g_pScriptVM, RegisterActivityConstants, "Registers all activity IDs as usable constants." );
//
// Math/world
//
ScriptRegisterConstantNamed( g_pScriptVM, ((float)(180.f / M_PI_F)), "RAD2DEG", "" );
ScriptRegisterConstantNamed( g_pScriptVM, ((float)(M_PI_F / 180.f)), "DEG2RAD", "" );
ScriptRegisterConstant( g_pScriptVM, MAX_COORD_FLOAT, "" );
ScriptRegisterConstant( g_pScriptVM, MAX_TRACE_LENGTH, "" );
//
// Damage Types
//

View File

@@ -389,7 +389,6 @@ void RegisterMathScriptFunctions()
{
ScriptRegisterFunction( g_pScriptVM, RandomFloat, "Generate a random floating point number within a range, inclusive." );
ScriptRegisterFunction( g_pScriptVM, RandomInt, "Generate a random integer within a range, inclusive." );
ScriptRegisterFunction( g_pScriptVM, Approach, "Returns a value which approaches the target value from the input value with the specified speed." );
ScriptRegisterFunction( g_pScriptVM, ApproachAngle, "Returns an angle which approaches the target angle from the input angle with the specified speed." );
ScriptRegisterFunction( g_pScriptVM, AngleDiff, "Returns the degrees difference between two yaw angles." );

View File

@@ -391,12 +391,7 @@ void AddThinkToEnt( HSCRIPT entity, const char *pszFuncName )
if (!pEntity)
return;
if (pszFuncName == NULL || pszFuncName[0] == '\0')
pEntity->m_iszScriptThinkFunction = NULL_STRING;
else
pEntity->m_iszScriptThinkFunction = AllocPooledString(pszFuncName);
pEntity->SetContextThink( &CBaseEntity::ScriptThink, gpGlobals->curtime, "ScriptThink" );
pEntity->ScriptSetThinkFunction(pszFuncName, 0.f);
}
HSCRIPT EntIndexToHScript( int index )
@@ -985,7 +980,14 @@ bool ScriptMatcherMatch( const char *pszQuery, const char *szValue ) { return Ma
//=============================================================================
//=============================================================================
bool IsServerScript()
#ifndef CLIENT_DLL
bool IsDedicatedServer()
{
return engine->IsDedicatedServer();
}
#endif
bool ScriptIsServer()
{
#ifdef GAME_DLL
return true;
@@ -994,7 +996,7 @@ bool IsServerScript()
#endif
}
bool IsClientScript()
bool ScriptIsClient()
{
#ifdef CLIENT_DLL
return true;
@@ -1003,6 +1005,12 @@ bool IsClientScript()
#endif
}
// Notification printing on the right edge of the screen
void NPrint(int pos, const char* fmt)
{
engine->Con_NPrintf(pos, fmt);
}
//=============================================================================
//=============================================================================
@@ -1017,9 +1025,6 @@ void RegisterSharedScriptFunctions()
//
#ifndef CLIENT_DLL
ScriptRegisterFunctionNamed( g_pScriptVM, NDebugOverlay::BoxDirection, "DebugDrawBoxDirection", "Draw a debug forward box" );
ScriptRegisterFunctionNamed( g_pScriptVM, NDebugOverlay::Text, "DebugDrawText", "Draw a debug overlay text" );
ScriptRegisterFunction( g_pScriptVM, EmitSoundOn, "Play named sound on an entity." );
ScriptRegisterFunction( g_pScriptVM, EmitSoundOnClient, "Play named sound only on the client for the specified player." );
@@ -1041,6 +1046,7 @@ void RegisterSharedScriptFunctions()
//-----------------------------------------------------------------------------
ScriptRegisterFunction( g_pScriptVM, NPrint, "" );
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptColorPrint, "printc", "Version of print() which takes a color before the message." );
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptColorPrintL, "printcl", "Version of printl() which takes a color before the message." );
@@ -1092,9 +1098,11 @@ void RegisterSharedScriptFunctions()
ScriptRegisterFunction( g_pScriptVM, Matcher_NamesMatch, "Compares a string to a query using Mapbase's matcher system using wildcards only." );
ScriptRegisterFunction( g_pScriptVM, AppearsToBeANumber, "Checks if the given string appears to be a number." );
// For shared server/clientside scripts
ScriptRegisterFunction( g_pScriptVM, IsServerScript, "Returns true if the script is being run on the server." );
ScriptRegisterFunction( g_pScriptVM, IsClientScript, "Returns true if the script is being run on the client." );
#ifndef CLIENT_DLL
ScriptRegisterFunction( g_pScriptVM, IsDedicatedServer, "Is this a dedicated server?" );
#endif
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptIsServer, "IsServer", "Returns true if the script is being run on the server." );
ScriptRegisterFunctionNamed( g_pScriptVM, ScriptIsClient, "IsClient", "Returns true if the script is being run on the client." );
RegisterMathScriptFunctions();