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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user