void CClientProjectileManager::DoPulse(void)
{
    CElementDeleter*                   pElementDeleter = g_pClientGame->GetElementDeleter();
    CClientProjectile*                 pProjectile = NULL;
    list<CClientProjectile*>           cloneList = m_List;
    list<CClientProjectile*>::iterator iter = cloneList.begin();
    for (; iter != cloneList.end(); ++iter)
    {
        pProjectile = *iter;

        // Is this projectile still active?
        if (pProjectile->IsActive())
        {
            pProjectile->DoPulse();
        }
    }
}
int CLuaFunctionDefs::GetProjectileCounter ( lua_State* luaVM )
{
    CClientProjectile* pProjectile = NULL;
    DWORD dwCounter = 0;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pProjectile );

    // Verify the argument
    if ( !argStream.HasErrors( ) )
    {
        dwCounter = pProjectile->GetCounter( );
        lua_pushnumber ( luaVM, dwCounter );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
int CLuaFunctionDefs::GetProjectileForce ( lua_State* luaVM )
{
    // Verify the argument
    if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA )
    {
        CClientProjectile* pProjectile = lua_toprojectile ( luaVM, 1 );
        if ( pProjectile )
        {
			lua_pushnumber ( luaVM, static_cast < lua_Number > ( pProjectile->GetForce() ) );
            return 1;
        }
        else
            m_pScriptDebugging->LogBadPointer ( luaVM, "projectile", 1 );
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM );

    lua_pushboolean ( luaVM, false );
    return 1;
}
int CLuaFunctionDefs::GetProjectileCreator ( lua_State* luaVM )
{
    // Verify the argument
    if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA )
    {
        CClientProjectile* pProjectile = lua_toprojectile ( luaVM, 1 );
        if ( pProjectile )
        {
			lua_pushelement ( luaVM, pProjectile->GetCreator() );
            return 1;
        }
        else
            m_pScriptDebugging->LogBadPointer ( luaVM, "projectile", 1 );
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM );

    lua_pushboolean ( luaVM, false );
    return 1;
}
int CLuaFunctionDefs::GetProjectileType ( lua_State* luaVM )
{
    // Verify the argument
    if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA )
    {
        CClientProjectile* pProjectile = lua_toprojectile ( luaVM, 1 );
        if ( pProjectile )
        {
            unsigned char ucWeapon = pProjectile->GetWeaponType();
            lua_pushnumber ( luaVM, static_cast < lua_Number > ( ucWeapon ) );
            return 1;
        }
        else
            m_pScriptDebugging->LogBadPointer ( luaVM, "getProjectileType", "pickup", 1 );
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM, "getProjectileType" );

    lua_pushboolean ( luaVM, false );
    return 1;
}
int CLuaFunctionDefs::GetProjectileTarget ( lua_State* luaVM )
{
    // Verify the argument
    if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA )
    {
        CClientProjectile* pProjectile = lua_toprojectile ( luaVM, 1 );
        if ( pProjectile )
        {
            unsigned char ucWeapon = pProjectile->GetWeaponType();
			if (ucWeapon == WEAPONTYPE_ROCKET_HS)
			{
				lua_pushelement ( luaVM, pProjectile->GetTargetEntity() );
                return 1;
			}
        }
        else
            m_pScriptDebugging->LogBadPointer ( luaVM, "projectile", 1 );
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM );

    lua_pushboolean ( luaVM, false );
    return 1;
}