DETOUR_DECL_MEMBER1(RemoveEntity, void, CBaseHandle, handle)
{
	CEntity *cent = CEntity::Instance(handle);
	if(cent)
	{
		cent->Destroy();
	}
	DETOUR_MEMBER_CALL(RemoveEntity)(handle);
}
void CEntityManager::RemoveEdict(edict_t *e)
{
	CEntity *pEnt = CEntity::Instance(e);
	if (pEnt)
	{
		assert(0);
		g_pSM->LogMessage(myself, "Edict Removed, removing CEntity");
		pEnt->Destroy();
	}
}
Exemplo n.º 3
0
void CGameWorld::RemoveEntities()
{
	// destroy objects marked for destruction
	for(int i = 0; i < NUM_ENTTYPES; i++)
		for(CEntity *pEnt = m_apFirstEntityTypes[i]; pEnt; )
		{
			m_pNextTraverseEntity = pEnt->m_pNextTypeEntity;
			if(pEnt->m_MarkedForDestroy)
			{
				RemoveEntity(pEnt);
				pEnt->Destroy();
			}
			pEnt = m_pNextTraverseEntity;
		}
}
Exemplo n.º 4
0
int CLuaFile::EntityDestroy(lua_State *L)
{
    lua_getglobal(L, "pLUA");
    CLuaFile *pSelf = (CLuaFile *)lua_touserdata(L, -1);
    lua_Debug Frame;
    lua_getstack(L, 1, &Frame);
    lua_getinfo(L, "nlSf", &Frame);

    if (!lua_isnumber(L, 1))
        return 0;

    CEntity *pEnt = pSelf->m_pServer->m_World.GetEntityByID(lua_tointeger(L, 1));
    if (pEnt)
    {
        pEnt->Destroy();
    }

    return 0;
}