예제 #1
0
파일: AI_Seeker.cpp 프로젝트: AlexXT/OpenJK
//------------------------------------
void NPC_BSSeeker_Default( void )
{
	if ( in_camera )
	{
		// cameras make me commit suicide....
		G_Damage( NPC, NPC, NPC, NULL, NULL, 999, 0, MOD_UNKNOWN );
	}

	if ( NPC->random == 0.0f )
	{
		// used to offset seekers around a circle so they don't occupy the same spot.  This is not a fool-proof method.
		NPC->random = random() * 6.3f; // roughly 2pi
	}

	if ( NPC->enemy && NPC->enemy->health && NPC->enemy->inuse )
	{
		if ( NPC->enemy->s.number == 0 || ( NPC->enemy->client && NPC->enemy->client->NPC_class == CLASS_SEEKER ))
		{
			//hacked to never take the player as an enemy, even if the player shoots at it
			NPC->enemy = NULL;
		}
		else
		{
			Seeker_Attack();
			return;
		}
	}

	// In all other cases, follow the player and look for enemies to take on
	Seeker_FollowPlayer();
}
예제 #2
0
//------------------------------------
void NPC_BSSeeker_Default( void )
{
    //[CoOp]
    //reenabled since we now have cutscene camera support
    if ( in_camera )
    {
        if ( NPC->client->NPC_class != CLASS_BOBAFETT )
        {
            // cameras make me commit suicide....
            G_Damage( NPC, NPC, NPC, NULL, NULL, 999, 0, MOD_UNKNOWN );
            //[SeekerItemNpc]
            //dont continue this run because we are dead
            return;
            //[/SeekerItemNpc]
        }
    }

    //[SeekerItemNpc]
    if ( NPC->client->NPC_class != CLASS_BOBAFETT && NPC->activator->health <= 0) {
        G_Damage( NPC, NPC, NPC, NULL, NULL, NPC->health, 0, MOD_UNKNOWN );
        return;
    }
    //[/SeekerItemNpc]


    /*
    //N/A for MP.
    if ( NPC->r.ownerNum < ENTITYNUM_NONE )
    {
    	gentity_t *owner = &g_entities[0];
    	if ( owner->health <= 0
    		|| (owner->client && owner->client->pers.connected == CON_DISCONNECTED) )
    	{//owner is dead or gone
    		//remove me
    		G_Damage( NPC, NULL, NULL, NULL, NULL, 10000, DAMAGE_NO_PROTECTION, MOD_TELEFRAG );
    		return;
    	}
    }
    */
    //[/CoOp]

    if ( NPC->random == 0.0f )
    {
        // used to offset seekers around a circle so they don't occupy the same spot.  This is not a fool-proof method.
        NPC->random = random() * 6.3f; // roughly 2pi
    }

    if ( NPC->enemy && NPC->enemy->health && NPC->enemy->inuse )
    {
        if ( NPC->client->NPC_class != CLASS_BOBAFETT
                //[CoOp]
                //[SeekerItemNpc] - dont attack our owner or leader, and dont shoot at dead people
                && ( NPC->enemy == NPC->activator || NPC->enemy == NPC->client->leader || !NPC->enemy->inuse || NPC->health <= 0 ||
                     ( NPC->enemy->client && NPC->enemy->client->NPC_class == CLASS_SEEKER )) )
            //&& ( NPC->enemy->s.number < MAX_CLIENTS || ( NPC->enemy->client && NPC->enemy->client->NPC_class == CLASS_SEEKER )) )
            //[/SeekerItemNpc]
            //&& ( NPC->enemy->s.number == 0 || ( NPC->enemy->client && NPC->enemy->client->NPC_class == CLASS_SEEKER )) )
            //[/CoOp]
        {
            //hacked to never take the player as an enemy, even if the player shoots at it
            NPC->enemy = NULL;
        }
        else
        {
            Seeker_Attack();
            if ( NPC->client->NPC_class == CLASS_BOBAFETT )
            {
                Boba_FireDecide();
            }
            //[SeekerItemNpc]
            //still follow our target, be it a targeted enemy or our owner, but only if we aren't allowed to hunt down enemies.
            if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES )
                return;
            //[/SeekerItemNpc]
        }
    }
    //[CoOp]
    else if ( NPC->client->NPC_class == CLASS_BOBAFETT )
    {   //boba does a ST patrol if it doesn't have an enemy.
        NPC_BSST_Patrol();
        return;
    }
    //[/CoOp]

    //[CoOp]
    // In all other cases, follow the player and look for enemies to take on
    Seeker_FollowPlayer();
    //Seeker_FollowOwner();
    //[/CoOp]
}