| 929 | */ |
| 930 | |
| 931 | qboolean NPC_ValidEnemy( gentity_t *ent ) |
| 932 | { |
| 933 | //Must be a valid pointer |
| 934 | if ( ent == NULL ) |
| 935 | return qfalse; |
| 936 | |
| 937 | //Must not be me |
| 938 | if ( ent == NPC ) |
| 939 | return qfalse; |
| 940 | |
| 941 | //Must not be deleted |
| 942 | if ( ent->inuse == qfalse ) |
| 943 | return qfalse; |
| 944 | |
| 945 | //Must be alive |
| 946 | if ( ent->health <= 0 ) |
| 947 | return qfalse; |
| 948 | |
| 949 | //In case they're in notarget mode |
| 950 | if ( ent->flags & FL_NOTARGET ) |
| 951 | return qfalse; |
| 952 | |
| 953 | //Must be an NPC |
| 954 | if ( ent->client == NULL ) |
| 955 | { |
| 956 | if ( ent->svFlags&SVF_NONNPC_ENEMY ) |
| 957 | {//still potentially valid |
| 958 | if ( ent->noDamageTeam == NPC->client->playerTeam ) |
| 959 | { |
| 960 | return qfalse; |
| 961 | } |
| 962 | else |
| 963 | { |
| 964 | return qtrue; |
| 965 | } |
| 966 | } |
| 967 | else |
| 968 | { |
| 969 | return qfalse; |
| 970 | } |
| 971 | } |
| 972 | |
| 973 | //Can't be on the same team |
| 974 | if ( ent->client->playerTeam == NPC->client->playerTeam ) |
| 975 | return qfalse; |
| 976 | |
| 977 | //if haven't seen him in a while, give up |
| 978 | //if ( NPCInfo->enemyLastSeenTime != 0 && level.time - NPCInfo->enemyLastSeenTime > 7000 )//FIXME: make a stat? |
| 979 | // return qfalse; |
| 980 | |
| 981 | return qtrue; |
| 982 | } |
| 983 | |
| 984 | /* |
| 985 | ------------------------- |
no outgoing calls
no test coverage detected