Fixes for the bots.

This commit is contained in:
Justin Marshall
2026-05-19 19:43:23 -07:00
parent af56d4bfeb
commit ed6b826d23
15 changed files with 1419 additions and 1103 deletions
+33 -1
View File
@@ -18,6 +18,38 @@ stateResult_t rvmBot::state_Attacked(stateParms_t* parms) {
return SRESULT_DONE_FRAME;
}
if( bs.enemy < 0 || bs.enemy >= gameLocal.num_entities || gameLocal.entities[bs.enemy] == NULL )
{
stateThread.SetState("state_SeekLTG");
return SRESULT_DONE_FRAME;
}
// Update combat distance before weapon selection so the bot can pick
// shotgun/rocket/plasma appropriately instead of using stale inventory
// values from the previous state.
BotUpdateBattleInventory( &bs, bs.enemy );
BotChooseWeapon( &bs );
// If we were ambushed while under-armed, do not stand and trade pistol shots.
// Use the existing BattleNBG state so the bot can keep aiming/firing while it
// moves through a nearby weapon, ammo, health, or armor pickup.
if( bs.check_time < Bot_Time() )
{
bs.check_time = Bot_Time() + 0.35f;
bot_goal_t pickupAnchor;
pickupAnchor.Reset();
pickupAnchor.entitynum = bs.enemy;
pickupAnchor.origin = bs.lastenemyorigin;
pickupAnchor.mins = idVec3( -8.0f, -8.0f, -8.0f );
pickupAnchor.maxs = idVec3( 8.0f, 8.0f, 8.0f );
if( BotNearbyGoal( &bs, 0, &pickupAnchor, 300.0f ) )
{
bs.nbg_time = Bot_Time() + 18.0f;
stateThread.SetState("state_BattleNBG");
return SRESULT_DONE_FRAME;
}
}
if (gameLocal.SysScriptTime() > bs.aggressiveAttackTime || bs.weaponnum == 0) {
stateThread.SetState("state_Retreat");
return SRESULT_DONE;
@@ -47,4 +79,4 @@ stateResult_t rvmBot::state_Attacked(stateParms_t* parms) {
BotCheckAttack(&bs);
return SRESULT_WAIT;
}
}