Exemplo n.º 1
0
/*
================
idBotAI::COMBAT_Vehicle_AttackEnemy
================
*/
bool idBotAI::COMBAT_Vehicle_AttackEnemy() {

    bool keepEnemy = true;

    if ( !enemyInfo.enemyVisible && enemyInfo.enemyLastVisTime + 5000 < botWorld->gameLocalInfo.time ) {
        if ( !Bot_ShouldVehicleChaseHiddenEnemy() ) {
            Bot_ResetEnemy();
            return false;
        }

        Bot_PickVehicleChaseType();
        return false;
    }

    Bot_PickBestVehicleWeapon();

    if ( vehicleUpdateTime < botWorld->gameLocalInfo.time ) {
        if ( VEHICLE_COMBAT_MOVEMENT_STATE == NULL ) {
            keepEnemy = Bot_FindBestVehicleCombatMovement();
        }
    }

    if ( !keepEnemy ) { //mal: make sure enemy is reachable by our current move state/abilities/limitations. If not, we have to forget them.
        Bot_IgnoreEnemy( enemy, 3000 ); //mal: perhaps in 3 seconds, we will have moved to a better position for a kill...
        Bot_ResetEnemy();
        return false;
    }

    if ( VEHICLE_COMBAT_MOVEMENT_STATE != NULL ) {
        CallFuncPtr( VEHICLE_COMBAT_MOVEMENT_STATE );
    }

    if ( ClientIsValid( enemy, enemySpawnID ) && enemyInfo.enemyVisible ) {
        if ( botVehicleInfo->type <= ICARUS || botInfo->proxyInfo.weapon == MINIGUN ) {
            Bot_LookAtEntity( enemy, AIM_TURN ); //mal: aim at the enemy - but let the game side code handle it.
            Bot_CheckVehicleAttack();
        }
    }

    return false;
}
Exemplo n.º 2
0
/*
================
idBotAI::Think

This is the start of the bot's thinking process, called
every game frame by the server.
================
*/
void idBotAI::Think() {
	botInfo = &botThreadData.GetBotWorldState()->clientInfo[ botNum ];
	botUcmd = &botThreadData.GetBotOutputState()->botOutput[ botNum ];
	botWorld = botThreadData.GetBotWorldState();
	botVehicleInfo = GetBotVehicleInfo( botInfo->proxyInfo.entNum );

	BotAI_ResetUcmd();

	if ( !BotAI_CheckThinkState() ) {
		return;
	}

	BotAI_UpdateStateInfo();

	RunDebugChecks();

	UpdateAAS();

	if ( botVehicleInfo != NULL ) {
		VThink(); //mal: if bot is in a vehicle, run vehicle specific AI.
		return;
	}

	if ( ROOT_AI_NODE == NULL ) {		
		Bot_ResetState( false, false );
        ROOT_AI_NODE = &idBotAI::Run_LTG_Node;
	}

	if ( botAAS.blockedByObstacleCounterOnFoot > MAX_FRAMES_BLOCKED_BY_OBSTACLE_ON_FOOT ) {
		Bot_ResetState( true, true );
		botAAS.blockedByObstacleCounterOnFoot = 0;
		ROOT_AI_NODE = &idBotAI::Run_LTG_Node;
	}

    CallFuncPtr( ROOT_AI_NODE ); //mal: run the bot's current think node

	Bot_Input();

	CheckBotStuckState();
}