// Actual work code IterationRetval_t CASW_MarineAndObjectEnumerator::EnumElement( IHandleEntity *pHandleEntity ) { if ( !m_pLocal ) return ITERATION_STOP; C_BaseEntity *pEnt = ClientEntityList().GetBaseEntityFromHandle( pHandleEntity->GetRefEHandle() ); if ( pEnt == NULL ) return ITERATION_CONTINUE; if ( pEnt == m_pLocal ) return ITERATION_CONTINUE; if ( !pEnt->IsPlayer() && !pEnt->IsNPC() ) { return ITERATION_CONTINUE; } if ( pEnt->IsNPC() ) { C_AI_BaseNPC *pNPC = (C_AI_BaseNPC *)pEnt; if ( !pNPC->ShouldAvoidObstacle() ) return ITERATION_CONTINUE; } // Ignore vehicles, since they have vcollide collisions that's push me away if ( pEnt->GetCollisionGroup() == COLLISION_GROUP_VEHICLE ) return ITERATION_CONTINUE; #ifdef TF2_CLIENT_DLL // If it's solid to player movement, don't steer around it since we'll just bump into it if ( pEnt->GetCollisionGroup() == TFCOLLISION_GROUP_OBJECT_SOLIDTOPLAYERMOVEMENT ) return ITERATION_CONTINUE; #endif C_ASW_Marine *pMarine = m_pLocal->GetMarine(); if (!pMarine) return ITERATION_CONTINUE; Vector deltaPos = pEnt->GetAbsOrigin() - pMarine->GetAbsOrigin(); //if ( deltaPos.LengthSqr() > m_flRadiusSquared ) //return ITERATION_CONTINUE; CHandle< C_BaseEntity > h; h = pEnt; m_Objects.AddToTail( h ); return ITERATION_CONTINUE; }
// Actual work code IterationRetval_t CPlayerAndObjectEnumerator::EnumElement( IHandleEntity *pHandleEntity ) { if ( !m_pLocal ) return ITERATION_STOP; C_BaseEntity *pEnt = ClientEntityList().GetBaseEntityFromHandle( pHandleEntity->GetRefEHandle() ); if ( pEnt == NULL ) return ITERATION_CONTINUE; if ( pEnt == m_pLocal ) return ITERATION_CONTINUE; if ( !pEnt->IsPlayer() && !pEnt->IsBaseObject() ) { return ITERATION_CONTINUE; } // Ignore vehicles, since they have vcollide collisions that's push me away if ( pEnt->GetCollisionGroup() == COLLISION_GROUP_VEHICLE ) return ITERATION_CONTINUE; // If it's solid to player movement, don't steer around it since we'll just bump into it if ( pEnt->GetCollisionGroup() == TFCOLLISION_GROUP_OBJECT_SOLIDTOPLAYERMOVEMENT ) return ITERATION_CONTINUE; Vector deltaPos = pEnt->GetAbsOrigin() - m_pLocal->GetAbsOrigin(); if ( deltaPos.LengthSqr() > m_flRadiusSquared ) return ITERATION_CONTINUE; CHandle< C_BaseEntity > h; h = pEnt; m_Objects.AddToTail( h ); return ITERATION_CONTINUE; }
virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask ) { // Test against the vehicle too? // FLASHLIGHTFIXME: how do you know that you are actually inside of the vehicle? C_BaseEntity *pEntity = EntityFromEntityHandle( pServerEntity ); if ( !pEntity ) return true; if ( ( dynamic_cast<C_BaseViewModel *>( pEntity ) != NULL ) || ( dynamic_cast<C_BasePlayer *>( pEntity ) != NULL ) || pEntity->GetCollisionGroup() == COLLISION_GROUP_DEBRIS || pEntity->GetCollisionGroup() == COLLISION_GROUP_INTERACTIVE_DEBRIS ) { return false; } return true; }
// Actual work code IterationRetval_t CPlayerAndObjectEnumerator::EnumElement( IHandleEntity *pHandleEntity ) { if ( !m_pLocal ) return ITERATION_STOP; C_BaseEntity *pEnt = ClientEntityList().GetBaseEntityFromHandle( pHandleEntity->GetRefEHandle() ); if ( pEnt == NULL ) return ITERATION_CONTINUE; if ( pEnt == m_pLocal ) return ITERATION_CONTINUE; if ( !pEnt->IsPlayer() && !pEnt->IsNPC() ) { return ITERATION_CONTINUE; } if ( pEnt->IsNPC() ) { C_AI_BaseNPC *pNPC = (C_AI_BaseNPC *)pEnt; if ( !pNPC->ShouldAvoidObstacle() ) return ITERATION_CONTINUE; } // Ignore vehicles, since they have vcollide collisions that's push me away if ( pEnt->GetCollisionGroup() == COLLISION_GROUP_VEHICLE ) return ITERATION_CONTINUE; Vector deltaPos = pEnt->GetAbsOrigin() - m_pLocal->GetAbsOrigin(); if ( deltaPos.LengthSqr() > m_flRadiusSquared ) return ITERATION_CONTINUE; CHandle< C_BaseEntity > h; h = pEnt; m_Objects.AddToTail( h ); return ITERATION_CONTINUE; }