Skip to content

Commit 5c20518

Browse files
authored
Merge pull request #47 from samisalreadytaken/pr16
VScript changes
2 parents c448f19 + 5e21095 commit 5c20518

13 files changed

Lines changed: 988 additions & 76 deletions

sp/src/game/client/c_baseentity.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,16 @@ BEGIN_RECV_TABLE_NOBASE( C_BaseEntity, DT_AnimTimeMustBeFirst )
426426
END_RECV_TABLE()
427427

428428
BEGIN_ENT_SCRIPTDESC_ROOT( C_BaseEntity, "Root class of all client-side entities" )
429-
DEFINE_SCRIPTFUNC_NAMED( GetAbsOrigin, "GetOrigin", "" )
430-
DEFINE_SCRIPTFUNC_NAMED( ScriptGetForward, "GetForwardVector", "Get the forward vector of the entity" )
431-
DEFINE_SCRIPTFUNC_NAMED( ScriptGetLeft, "GetLeftVector", "Get the left vector of the entity" )
432-
DEFINE_SCRIPTFUNC_NAMED( ScriptGetUp, "GetUpVector", "Get the up vector of the entity" )
433-
DEFINE_SCRIPTFUNC( GetTeamNumber, "Gets this entity's team" )
429+
DEFINE_SCRIPTFUNC_NAMED( GetAbsOrigin, "GetOrigin", "" )
430+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetForward, "GetForwardVector", "Get the forward vector of the entity" )
431+
#ifdef MAPBASE_VSCRIPT
432+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetRight, "GetRightVector", "Get the right vector of the entity" )
433+
DEFINE_SCRIPTFUNC_NAMED( GetTeamNumber, "GetTeam", "Gets this entity's team" )
434+
#endif
435+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetLeft, "GetLeftVector", SCRIPT_HIDE )
436+
DEFINE_SCRIPTFUNC_NAMED( GetTeamNumber, "GetTeamNumber", SCRIPT_HIDE )
437+
438+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetUp, "GetUpVector", "Get the up vector of the entity" )
434439

435440
#ifdef MAPBASE_VSCRIPT
436441
DEFINE_SCRIPTFUNC( GetHealth, "" )

sp/src/game/client/c_baseentity.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,11 @@ class C_BaseEntity : public IClientEntity
11321132
virtual int GetSkin() { return 0; }
11331133

11341134
const Vector& ScriptGetForward(void) { static Vector vecForward; GetVectors(&vecForward, NULL, NULL); return vecForward; }
1135-
const Vector& ScriptGetLeft(void) { static Vector vecLeft; GetVectors(NULL, &vecLeft, NULL); return vecLeft; }
1135+
#ifdef MAPBASE_VSCRIPT
1136+
const Vector& ScriptGetRight(void) { static Vector vecRight; GetVectors(NULL, &vecRight, NULL); return vecRight; }
1137+
#endif
1138+
const Vector& ScriptGetLeft(void) { static Vector vecRight; GetVectors(NULL, &vecRight, NULL); return vecRight; }
1139+
11361140
const Vector& ScriptGetUp(void) { static Vector vecUp; GetVectors(NULL, NULL, &vecUp); return vecUp; }
11371141

11381142
#ifdef MAPBASE_VSCRIPT

sp/src/game/server/baseentity.cpp

Lines changed: 216 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,9 @@ BEGIN_DATADESC_NO_BASE( CBaseEntity )
21362136
DEFINE_FUNCTION( SUB_CallUseToggle ),
21372137
DEFINE_THINKFUNC( ShadowCastDistThink ),
21382138
DEFINE_THINKFUNC( ScriptThink ),
2139+
#ifdef MAPBASE_VSCRIPT
2140+
DEFINE_THINKFUNC( ScriptThinkH ),
2141+
#endif
21392142

21402143
#ifdef MAPBASE
21412144
DEFINE_FUNCTION( SUB_RemoveWhenNotVisible ),
@@ -2173,6 +2176,10 @@ BEGIN_ENT_SCRIPTDESC_ROOT( CBaseEntity, "Root class of all server-side entities"
21732176

21742177
DEFINE_SCRIPTFUNC( GetClassname, "" )
21752178
DEFINE_SCRIPTFUNC_NAMED( GetEntityNameAsCStr, "GetName", "" )
2179+
#ifdef MAPBASE_VSCRIPT
2180+
DEFINE_SCRIPTFUNC( GetDebugName, "If name exists returns name, otherwise returns classname" )
2181+
DEFINE_SCRIPTFUNC_NAMED( SetNameAsCStr, "SetName", "" )
2182+
#endif
21762183
DEFINE_SCRIPTFUNC( GetPreTemplateName, "Get the entity name stripped of template unique decoration" )
21772184

21782185
DEFINE_SCRIPTFUNC_NAMED( GetAbsOrigin, "GetOrigin", "" )
@@ -2185,11 +2192,15 @@ BEGIN_ENT_SCRIPTDESC_ROOT( CBaseEntity, "Root class of all server-side entities"
21852192
DEFINE_SCRIPTFUNC( GetLocalAngles, "GetLocalAngles" )
21862193
DEFINE_SCRIPTFUNC( SetLocalAngles, "SetLocalAngles" )
21872194
#endif
2188-
21892195

21902196
DEFINE_SCRIPTFUNC_NAMED( ScriptSetOrigin, "SetOrigin", "" )
2197+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetForward, "SetForwardVector", "Set the orientation of the entity to have this forward vector" )
21912198
DEFINE_SCRIPTFUNC_NAMED( ScriptGetForward, "GetForwardVector", "Get the forward vector of the entity" )
2192-
DEFINE_SCRIPTFUNC_NAMED( ScriptGetLeft, "GetLeftVector", "Get the left vector of the entity" )
2199+
#ifdef MAPBASE_VSCRIPT
2200+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetRight, "GetRightVector", "Get the right vector of the entity" )
2201+
#endif
2202+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetLeft, "GetLeftVector", SCRIPT_HIDE )
2203+
21932204
DEFINE_SCRIPTFUNC_NAMED( ScriptGetUp, "GetUpVector", "Get the up vector of the entity" )
21942205

21952206
#ifdef MAPBASE_VSCRIPT
@@ -2199,16 +2210,17 @@ BEGIN_ENT_SCRIPTDESC_ROOT( CBaseEntity, "Root class of all server-side entities"
21992210
DEFINE_SCRIPTFUNC_NAMED( ScriptEntityToWorldTransform, "EntityToWorldTransform", "Get the entity's transform" )
22002211

22012212
DEFINE_SCRIPTFUNC_NAMED( ScriptGetPhysicsObject, "GetPhysicsObject", "Get the entity's physics object if it has one" )
2213+
2214+
DEFINE_SCRIPTFUNC( ApplyAbsVelocityImpulse, "" )
2215+
DEFINE_SCRIPTFUNC( ApplyLocalAngularVelocityImpulse, "" )
22022216
#endif
22032217

2204-
DEFINE_SCRIPTFUNC_NAMED( ScriptSetForward, "SetForwardVector", "Set the orientation of the entity to have this forward vector" )
22052218
DEFINE_SCRIPTFUNC_NAMED( GetAbsVelocity, "GetVelocity", "" )
22062219
DEFINE_SCRIPTFUNC_NAMED( SetAbsVelocity, "SetVelocity", "" )
22072220

22082221
DEFINE_SCRIPTFUNC_NAMED( ScriptSetLocalAngularVelocity, "SetAngularVelocity", "Set the local angular velocity - takes float pitch,yaw,roll velocities" )
22092222
DEFINE_SCRIPTFUNC_NAMED( ScriptGetLocalAngularVelocity, "GetAngularVelocity", "Get the local angular velocity - returns a vector of pitch,yaw,roll" )
22102223

2211-
22122224
DEFINE_SCRIPTFUNC_NAMED( WorldSpaceCenter, "GetCenter", "Get vector to center of object - absolute coords")
22132225
DEFINE_SCRIPTFUNC_NAMED( ScriptEyePosition, "EyePosition", "Get vector to eye position - absolute coords")
22142226
#ifdef MAPBASE_VSCRIPT
@@ -2225,7 +2237,10 @@ BEGIN_ENT_SCRIPTDESC_ROOT( CBaseEntity, "Root class of all server-side entities"
22252237
DEFINE_SCRIPTFUNC_NAMED( ScriptSetOwner, "SetOwner", "" )
22262238
DEFINE_SCRIPTFUNC_NAMED( GetTeamNumber, "GetTeam", "" )
22272239
DEFINE_SCRIPTFUNC_NAMED( ChangeTeam, "SetTeam", "" )
2228-
2240+
2241+
#ifdef MAPBASE_VSCRIPT
2242+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetParent, "SetParent", "" )
2243+
#endif
22292244
DEFINE_SCRIPTFUNC_NAMED( ScriptGetMoveParent, "GetMoveParent", "If in hierarchy, retrieves the entity's parent" )
22302245
DEFINE_SCRIPTFUNC_NAMED( ScriptGetRootMoveParent, "GetRootMoveParent", "If in hierarchy, walks up the hierarchy to find the root parent" )
22312246
DEFINE_SCRIPTFUNC_NAMED( ScriptFirstMoveChild, "FirstMoveChild", "" )
@@ -2259,16 +2274,28 @@ BEGIN_ENT_SCRIPTDESC_ROOT( CBaseEntity, "Root class of all server-side entities"
22592274
DEFINE_SCRIPTFUNC_NAMED( ScriptAddOutput, "AddOutput", "Add an output" )
22602275
DEFINE_SCRIPTFUNC_NAMED( ScriptGetKeyValue, "GetKeyValue", "Get a keyvalue" )
22612276

2262-
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorVector, "GetColorVector", "Get the render color as a vector" )
2263-
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorR, "GetColorR", "Get the render color's R value" )
2264-
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorG, "GetColorG", "Get the render color's G value" )
2265-
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorB, "GetColorB", "Get the render color's B value" )
2266-
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAlpha, "GetAlpha", "Get the render color's alpha value" )
2267-
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorVector, "SetColorVector", "Set the render color as a vector" )
2268-
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorR, "SetColorR", "Set the render color's R value" )
2269-
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorG, "SetColorG", "Set the render color's G value" )
2270-
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorB, "SetColorB", "Set the render color's B value" )
2271-
DEFINE_SCRIPTFUNC_NAMED( ScriptSetAlpha, "SetAlpha", "Set the render color's alpha value" )
2277+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorVector, "GetRenderColorVector", "Get the render color as a vector" )
2278+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorR, "GetRenderColorR", "Get the render color's R value" )
2279+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorG, "GetRenderColorG", "Get the render color's G value" )
2280+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorB, "GetRenderColorB", "Get the render color's B value" )
2281+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAlpha, "GetRenderAlpha", "Get the render color's alpha value" )
2282+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorVector, "SetRenderColorVector", "Set the render color as a vector" )
2283+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColor, "SetRenderColor", "Set the render color" )
2284+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorR, "SetRenderColorR", "Set the render color's R value" )
2285+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorG, "SetRenderColorG", "Set the render color's G value" )
2286+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorB, "SetRenderColorB", "Set the render color's B value" )
2287+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetAlpha, "SetRenderAlpha", "Set the render color's alpha value" )
2288+
2289+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorVector, "GetColorVector", SCRIPT_HIDE )
2290+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorR, "GetColorR", SCRIPT_HIDE )
2291+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorG, "GetColorG", SCRIPT_HIDE )
2292+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorB, "GetColorB", SCRIPT_HIDE )
2293+
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAlpha, "GetAlpha", SCRIPT_HIDE )
2294+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorVector, "SetColorVector", SCRIPT_HIDE )
2295+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorR, "SetColorR", SCRIPT_HIDE )
2296+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorG, "SetColorG", SCRIPT_HIDE )
2297+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorB, "SetColorB", SCRIPT_HIDE )
2298+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetAlpha, "SetAlpha", SCRIPT_HIDE )
22722299

22732300
DEFINE_SCRIPTFUNC_NAMED( ScriptGetRenderMode, "GetRenderMode", "Get render mode" )
22742301
DEFINE_SCRIPTFUNC_NAMED( ScriptSetRenderMode, "SetRenderMode", "Set render mode" )
@@ -2296,6 +2323,13 @@ BEGIN_ENT_SCRIPTDESC_ROOT( CBaseEntity, "Root class of all server-side entities"
22962323
DEFINE_SCRIPTFUNC( GetCollisionGroup, "Get the collision group" )
22972324
DEFINE_SCRIPTFUNC( SetCollisionGroup, "Set the collision group" )
22982325

2326+
DEFINE_SCRIPTFUNC( GetGravity, "" )
2327+
DEFINE_SCRIPTFUNC( SetGravity, "" )
2328+
DEFINE_SCRIPTFUNC( GetFriction, "" )
2329+
DEFINE_SCRIPTFUNC( SetFriction, "" )
2330+
DEFINE_SCRIPTFUNC( GetMass, "" )
2331+
DEFINE_SCRIPTFUNC( SetMass, "" )
2332+
22992333
DEFINE_SCRIPTFUNC( GetSolidFlags, "Get solid flags" )
23002334
DEFINE_SCRIPTFUNC( AddSolidFlags, "Add solid flags" )
23012335
DEFINE_SCRIPTFUNC( RemoveSolidFlags, "Remove solid flags" )
@@ -2305,14 +2339,26 @@ BEGIN_ENT_SCRIPTDESC_ROOT( CBaseEntity, "Root class of all server-side entities"
23052339
DEFINE_SCRIPTFUNC( IsCombatCharacter, "Returns true if this entity is a combat character (player or NPC)." )
23062340
DEFINE_SCRIPTFUNC_NAMED( IsBaseCombatWeapon, "IsWeapon", "Returns true if this entity is a weapon." )
23072341
DEFINE_SCRIPTFUNC( IsWorld, "Returns true if this entity is the world." )
2342+
2343+
// DEFINE_SCRIPTFUNC( IsMarkedForDeletion, "Returns true if the entity is valid and marked for deletion." )
23082344
#endif
23092345

23102346
DEFINE_SCRIPTFUNC( ValidateScriptScope, "Ensure that an entity's script scope has been created" )
23112347
DEFINE_SCRIPTFUNC( GetScriptScope, "Retrieve the script-side data associated with an entity" )
2348+
#ifdef MAPBASE_VSCRIPT
2349+
DEFINE_SCRIPTFUNC( GetOrCreatePrivateScriptScope, "Create and retrieve the script-side data associated with an entity" )
2350+
#endif
23122351
DEFINE_SCRIPTFUNC( GetScriptId, "Retrieve the unique identifier used to refer to the entity within the scripting system" )
23132352
DEFINE_SCRIPTFUNC_NAMED( GetScriptOwnerEntity, "GetOwner", "Gets this entity's owner" )
23142353
DEFINE_SCRIPTFUNC_NAMED( SetScriptOwnerEntity, "SetOwner", "Sets this entity's owner" )
23152354
DEFINE_SCRIPTFUNC( entindex, "" )
2355+
2356+
#ifdef MAPBASE_VSCRIPT
2357+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetThinkFunction, "SetThinkFunction", "" )
2358+
DEFINE_SCRIPTFUNC_NAMED( ScriptStopThinkFunction, "StopThinkFunction", "" )
2359+
DEFINE_SCRIPTFUNC_NAMED( ScriptSetThink, "SetThink", "" )
2360+
DEFINE_SCRIPTFUNC_NAMED( ScriptStopThink, "StopThink", "" )
2361+
#endif
23162362
END_SCRIPTDESC();
23172363

23182364

@@ -2418,6 +2464,13 @@ void CBaseEntity::UpdateOnRemove( void )
24182464

24192465
if ( m_hScriptInstance )
24202466
{
2467+
#ifdef MAPBASE_VSCRIPT
2468+
HSCRIPT hFunc = LookupScriptFunction("UpdateOnRemove");
2469+
if ( hFunc )
2470+
{
2471+
CallScriptFunctionHandle( hFunc, NULL );
2472+
}
2473+
#endif
24212474
g_pScriptVM->RemoveInstance( m_hScriptInstance );
24222475
m_hScriptInstance = NULL;
24232476
}
@@ -8341,30 +8394,171 @@ void CBaseEntity::ScriptThink(void)
83418394
// use default think interval if script think function doesn't provide one
83428395
flThinkFrequency = sv_script_think_interval.GetFloat();
83438396
}
8344-
SetContextThink(&CBaseEntity::ScriptThink,
8345-
gpGlobals->curtime + flThinkFrequency, "ScriptThink");
8397+
8398+
SetNextThink( gpGlobals->curtime + flThinkFrequency, "ScriptThink" );
83468399
}
83478400
else
83488401
{
83498402
DevWarning("%s FAILED to call script think function %s!\n", GetDebugName(), STRING(m_iszScriptThinkFunction));
83508403
}
83518404
}
83528405

8406+
#ifdef MAPBASE_VSCRIPT
8407+
//-----------------------------------------------------------------------------
8408+
//-----------------------------------------------------------------------------
8409+
void CBaseEntity::ScriptSetThinkFunction(const char *szFunc, float time)
8410+
{
8411+
// Empty string stops thinking
8412+
if (!szFunc || szFunc[0] == '\0')
8413+
{
8414+
ScriptStopThinkFunction();
8415+
}
8416+
else
8417+
{
8418+
m_iszScriptThinkFunction = AllocPooledString(szFunc);
8419+
SetContextThink( &CBaseEntity::ScriptThink, gpGlobals->curtime + time, "ScriptThink" );
8420+
}
8421+
}
8422+
8423+
void CBaseEntity::ScriptStopThinkFunction()
8424+
{
8425+
m_iszScriptThinkFunction = NULL_STRING;
8426+
SetContextThink( NULL, TICK_NEVER_THINK, "ScriptThink" );
8427+
}
8428+
8429+
//-----------------------------------------------------------------------------
8430+
//-----------------------------------------------------------------------------
8431+
void CBaseEntity::ScriptThinkH()
8432+
{
8433+
if (m_hfnThink)
8434+
{
8435+
ScriptVariant_t varThinkRetVal;
8436+
if (g_pScriptVM->ExecuteFunction(m_hfnThink, NULL, 0, &varThinkRetVal, NULL, true) == SCRIPT_ERROR)
8437+
{
8438+
DevWarning("%s FAILED to call script think function (invalid closure)!\n", GetDebugName());
8439+
ScriptStopThink();
8440+
return;
8441+
}
8442+
8443+
float flThinkFrequency = 0.f;
8444+
if (!varThinkRetVal.AssignTo(&flThinkFrequency))
8445+
{
8446+
// no return value stops thinking
8447+
ScriptStopThink();
8448+
return;
8449+
}
8450+
8451+
SetNextThink(gpGlobals->curtime + flThinkFrequency, "ScriptThinkH");
8452+
}
8453+
else
8454+
{
8455+
DevWarning("%s FAILED to call script think function (invalid closure)!\n", GetDebugName());
8456+
}
8457+
}
8458+
8459+
void CBaseEntity::ScriptSetThink(HSCRIPT hFunc, float time)
8460+
{
8461+
if (hFunc)
8462+
{
8463+
if (m_hfnThink)
8464+
{
8465+
// release old func
8466+
ScriptStopThink();
8467+
}
8468+
8469+
// no type check here, print error on call instead
8470+
m_hfnThink = hFunc;
8471+
8472+
SetContextThink( &CBaseEntity::ScriptThinkH, gpGlobals->curtime + time, "ScriptThinkH" );
8473+
}
8474+
else
8475+
{
8476+
ScriptStopThink();
8477+
}
8478+
}
8479+
8480+
void CBaseEntity::ScriptStopThink()
8481+
{
8482+
if (m_hfnThink)
8483+
{
8484+
g_pScriptVM->ReleaseScript(m_hfnThink);
8485+
m_hfnThink = NULL;
8486+
}
8487+
SetContextThink( NULL, TICK_NEVER_THINK, "ScriptThinkH" );
8488+
}
8489+
#endif // MAPBASE_VSCRIPT
83538490

83548491
//-----------------------------------------------------------------------------
83558492
//-----------------------------------------------------------------------------
83568493
const char* CBaseEntity::GetScriptId()
83578494
{
8495+
#ifdef MAPBASE_VSCRIPT
8496+
return STRING(m_iszScriptId);
8497+
#else
83588498
return STRING(m_iszScriptThinkFunction);
8499+
#endif
83598500
}
83608501

8502+
//-----------------------------------------------------------------------------
8503+
// Recreate the old behaviour of GetScriptId under a new function
8504+
//-----------------------------------------------------------------------------
8505+
// const char* CBaseEntity::GetScriptThinkFunction()
8506+
// {
8507+
// return STRING(m_iszScriptThinkFunction);
8508+
// }
8509+
83618510
//-----------------------------------------------------------------------------
83628511
//-----------------------------------------------------------------------------
83638512
HSCRIPT CBaseEntity::GetScriptScope()
83648513
{
83658514
return m_ScriptScope;
83668515
}
83678516

8517+
//-----------------------------------------------------------------------------
8518+
//-----------------------------------------------------------------------------
8519+
#ifdef MAPBASE_VSCRIPT
8520+
HSCRIPT CBaseEntity::GetOrCreatePrivateScriptScope()
8521+
{
8522+
ValidateScriptScope();
8523+
return m_ScriptScope;
8524+
}
8525+
8526+
//-----------------------------------------------------------------------------
8527+
//-----------------------------------------------------------------------------
8528+
void CBaseEntity::ScriptSetParent(HSCRIPT hParent, const char *szAttachment)
8529+
{
8530+
CBaseEntity *pParent = ToEnt(hParent);
8531+
if ( !pParent )
8532+
{
8533+
SetParent(NULL);
8534+
return;
8535+
}
8536+
8537+
// if an attachment is specified, the parent needs to be CBaseAnimating
8538+
if ( szAttachment && szAttachment[0] != '\0' )
8539+
{
8540+
CBaseAnimating *pAnimating = pParent->GetBaseAnimating();
8541+
if ( !pAnimating )
8542+
{
8543+
Warning("ERROR: Tried to set parent for entity %s (%s), but its parent has no model.\n", GetClassname(), GetDebugName());
8544+
return;
8545+
}
8546+
8547+
int iAttachment = pAnimating->LookupAttachment(szAttachment);
8548+
if ( iAttachment <= 0 )
8549+
{
8550+
Warning("ERROR: Tried to set parent for entity %s (%s), but it has no attachment named %s.\n", GetClassname(), GetDebugName(), szAttachment);
8551+
return;
8552+
}
8553+
8554+
SetParent(pParent, iAttachment);
8555+
SetMoveType(MOVETYPE_NONE);
8556+
return;
8557+
}
8558+
8559+
SetParent(pParent);
8560+
}
8561+
#endif
83688562
//-----------------------------------------------------------------------------
83698563
//-----------------------------------------------------------------------------
83708564
HSCRIPT CBaseEntity::ScriptGetMoveParent(void)
@@ -9762,6 +9956,11 @@ void CBaseEntity::ScriptSetColorVector( const Vector& vecColor )
97629956
SetRenderColor( vecColor.x, vecColor.y, vecColor.z );
97639957
}
97649958

9959+
void CBaseEntity::ScriptSetColor( int r, int g, int b )
9960+
{
9961+
SetRenderColor( r, g, b );
9962+
}
9963+
97659964
//-----------------------------------------------------------------------------
97669965
// Vscript: Gets the entity matrix transform
97679966
//-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)