mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-18 03:35:07 +02:00
Fixes for the bots.
This commit is contained in:
@@ -26,7 +26,7 @@ stateResult_t rvmBot::state_Retreat(stateParms_t* parms)
|
||||
}
|
||||
|
||||
// if no enemy.
|
||||
if( bs.enemy < 0 )
|
||||
if( bs.enemy < 0 || bs.enemy >= gameLocal.num_entities || gameLocal.entities[bs.enemy] == NULL )
|
||||
{
|
||||
stateThread.SetState("state_SeekLTG");
|
||||
return SRESULT_DONE_FRAME;
|
||||
@@ -57,6 +57,27 @@ stateResult_t rvmBot::state_Retreat(stateParms_t* parms)
|
||||
|
||||
//update the attack inventory values
|
||||
BotUpdateBattleInventory( &bs, bs.enemy );
|
||||
BotChooseWeapon( &bs );
|
||||
|
||||
// Before switching back to chase, opportunistically grab a nearby tactical
|
||||
// pickup. This keeps the bot from running past a rocket launcher, shells, or
|
||||
// health while it is already committed to a fight.
|
||||
if( bs.check_time < Bot_Time() )
|
||||
{
|
||||
bs.check_time = Bot_Time() + 0.5f;
|
||||
bot_goal_t pickupAnchor;
|
||||
pickupAnchor.Reset();
|
||||
pickupAnchor.entitynum = bs.enemy;
|
||||
pickupAnchor.origin = entinfo->GetOrigin();
|
||||
pickupAnchor.mins = idVec3( -8.0f, -8.0f, -8.0f );
|
||||
pickupAnchor.maxs = idVec3( 8.0f, 8.0f, 8.0f );
|
||||
if( BotNearbyGoal( &bs, 0, &pickupAnchor, 260.0f ) )
|
||||
{
|
||||
bs.nbg_time = Bot_Time() + 18.0f;
|
||||
stateThread.SetState("state_BattleNBG");
|
||||
return SRESULT_DONE_FRAME;
|
||||
}
|
||||
}
|
||||
|
||||
//if the bot doesn't want to retreat anymore... probably picked up some nice items
|
||||
if( BotWantsToChase( &bs ) )
|
||||
@@ -76,6 +97,7 @@ stateResult_t rvmBot::state_Retreat(stateParms_t* parms)
|
||||
bs.enemyvisible_time = Bot_Time();
|
||||
target = entinfo->GetOrigin();
|
||||
bs.lastenemyorigin = target;
|
||||
bs.last_enemy_visible_position = target;
|
||||
}
|
||||
|
||||
//if the enemy is NOT visible for 4 seconds
|
||||
@@ -108,19 +130,15 @@ stateResult_t rvmBot::state_Retreat(stateParms_t* parms)
|
||||
return SRESULT_DONE_FRAME;
|
||||
}
|
||||
|
||||
//check for nearby goals periodicly
|
||||
//check for nearby goals periodically while retreating along the long-term item path
|
||||
if( bs.check_time < Bot_Time() )
|
||||
{
|
||||
bs.check_time = Bot_Time() + 1;
|
||||
range = 150;
|
||||
bs.check_time = Bot_Time() + 0.5f;
|
||||
range = 260.0f;
|
||||
|
||||
//
|
||||
if( BotNearbyGoal( &bs, 0, &goal, range ) )
|
||||
{
|
||||
//trap_BotResetLastAvoidReach(bs.ms);
|
||||
//time the bot gets to pick up the nearby goal item
|
||||
bs.nbg_time = Bot_Time() + range / 100 + 1;
|
||||
//AIEnter_Battle_NBG(bs, "battle retreat: nbg");
|
||||
bs.nbg_time = Bot_Time() + 18.0f;
|
||||
stateThread.SetState("state_BattleNBG");
|
||||
return SRESULT_DONE_FRAME;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user