Added a few more VScript base entity functions to the client

This commit is contained in:
Blixibon
2020-12-25 23:53:59 -06:00
parent 5e254d19c0
commit cb7cee6283
4 changed files with 65 additions and 45 deletions

View File

@@ -2621,6 +2621,58 @@ bool CBaseEntity::IsToolRecording() const
#endif
#ifdef MAPBASE_VSCRIPT
HSCRIPT CBaseEntity::GetOrCreatePrivateScriptScope()
{
ValidateScriptScope();
return m_ScriptScope;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CBaseEntity::ScriptSetParent(HSCRIPT hParent, const char *szAttachment)
{
CBaseEntity *pParent = ToEnt(hParent);
if ( !pParent )
{
SetParent(NULL);
return;
}
// if an attachment is specified, the parent needs to be CBaseAnimating
if ( szAttachment && szAttachment[0] != '\0' )
{
CBaseAnimating *pAnimating = pParent->GetBaseAnimating();
if ( !pAnimating )
{
Warning("ERROR: Tried to set parent for entity %s (%s), but its parent has no model.\n", GetClassname(), GetDebugName());
return;
}
int iAttachment = pAnimating->LookupAttachment(szAttachment);
if ( iAttachment <= 0 )
{
Warning("ERROR: Tried to set parent for entity %s (%s), but it has no attachment named %s.\n", GetClassname(), GetDebugName(), szAttachment);
return;
}
SetParent(pParent, iAttachment);
SetMoveType(MOVETYPE_NONE);
return;
}
SetParent(pParent);
}
HSCRIPT CBaseEntity::GetScriptOwnerEntity()
{
return ToHScript(GetOwnerEntity());
}
void CBaseEntity::SetScriptOwnerEntity(HSCRIPT pOwner)
{
SetOwnerEntity(ToEnt(pOwner));
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
const Vector& CBaseEntity::ScriptGetColorVector()