//----------------------------------------------------------------------------- // Purpose: Used to specify that the NPC has a reason not to use the a navigation node // Input : // Output : //----------------------------------------------------------------------------- bool CAI_BaseNPC::IsUnusableNode(int iNodeID, CAI_Hint *pHint) { if ( m_bHintGroupNavLimiting && m_strHintGroup != NULL_STRING && STRING(m_strHintGroup)[0] != 0 ) { if (!pHint || pHint->GetGroup() != GetHintGroup()) { return true; } } return false; }
//----------------------------------------------------------------------------- // Purpose: Is squad member in my way from shooting here // Input : // Output : //----------------------------------------------------------------------------- bool CAI_BaseNPC::IsValidShootPosition ( const Vector &vecShootLocation, CAI_Hint const *pHint ) { // limit choices to hint groups if (GetHintGroup() != NULL_STRING) { if (!pHint || pHint->GetGroup() != GetHintGroup()) { return false; } } /* if ( m_pSquad ) { return m_pSquad->IsValidShootPosition( vecShootLocation, pHint ); } */ return true; }
//------------------------------------------------------------------------------ // Purpose : Is cover node valid // Input : // Output : //------------------------------------------------------------------------------ bool CAI_BaseNPC::IsValidCover( const Vector &vecCoverLocation, CAI_Hint const *pHint ) { // firstly, limit choices to hint groups string_t iszHint = GetHintGroup(); char *pszHint = (char *)STRING(iszHint); if ((iszHint != NULL_STRING) && (pszHint[0] != '\0')) { if (!pHint || pHint->GetGroup() != GetHintGroup()) { return false; } } /* // If I'm in a squad don't pick cover node it other squad member // is already nearby if (m_pSquad) { return m_pSquad->IsValidCover( vecCoverLocation, pHint ); } */ // UNDONE: Do we really need this test? // ---------------------------------------------------------------- // Make sure my hull can fit at this node before accepting it. // Could be another NPC there or it could be blocked // ---------------------------------------------------------------- // FIXME: shouldn't this see that if I crouch behind it it'll be safe? Vector startPos = vecCoverLocation; startPos.z -= GetHullMins().z; // Move hull bottom up to node Vector endPos = startPos; endPos.z += 0.01; trace_t tr; AI_TraceEntity( this, vecCoverLocation, endPos, MASK_NPCSOLID, &tr ); if (tr.startsolid) { return false; } return true; }