Use updated IServerTools iface on TF2 for getting tempent list and FindEntityByClassname.

This commit is contained in:
Nicholas Hastings 2014-06-11 22:44:42 -04:00
parent 5f8288dc70
commit a697e81427
2 changed files with 25 additions and 1 deletions

View File

@ -285,6 +285,9 @@ void TempEntityManager::Initialize()
int offset;
m_Loaded = false;
#if SOURCE_ENGINE == SE_TF2
m_ListHead = servertools->GetTempEntList();
#else
/*
* First try to lookup s_pTempEntities directly for platforms with symbols.
* If symbols aren't present (Windows or stripped Linux/Mac),
@ -311,6 +314,7 @@ void TempEntityManager::Initialize()
{
return;
}
#endif
if (!g_pGameConf->GetOffset("GetTEName", &m_NameOffs))
{

View File

@ -714,7 +714,7 @@ static cell_t GetClientEyeAngles(IPluginContext *pContext, const cell_t *params)
return got_angles ? 1 : 0;
}
#if SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE >= SE_ORANGEBOX && SOURCE_ENGINE != SE_TF2
static cell_t NativeFindEntityByClassname(IPluginContext *pContext, const cell_t *params)
{
char *searchname;
@ -793,6 +793,25 @@ static cell_t NativeFindEntityByClassname(IPluginContext *pContext, const cell_t
static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *params)
{
#if SOURCE_ENGINE == SE_TF2
CBaseEntity *pStartEnt = NULL;
if (params[1] != -1)
{
pStartEnt = gamehelpers->ReferenceToEntity(params[1]);
if (!pStartEnt)
{
return pContext->ThrowNativeError("Entity %d (%d) is invalid",
gamehelpers->ReferenceToIndex(params[1]),
params[1]);
}
}
char *searchname;
pContext->LocalToString(params[2], &searchname);
CBaseEntity *pEntity = servertools->FindEntityByClassname(pStartEnt, searchname);
return gamehelpers->EntityToBCompatRef(pEntity);
#else
static ValveCall *pCall = NULL;
static bool bProbablyNoFEBC = false;
@ -850,6 +869,7 @@ static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *para
FINISH_CALL_SIMPLE(&pEntity);
return gamehelpers->EntityToBCompatRef(pEntity);
#endif
}
#if SOURCE_ENGINE >= SE_ORANGEBOX