nav: directly reach the next node if bot lost the path

chatter: increase minimum voice pitch
radio : probably fix for cycling ``hold this position`` message (ref #560)
This commit is contained in:
jeefo 2024-05-03 00:11:14 +03:00
commit 79320802bb
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
3 changed files with 13 additions and 4 deletions

View file

@ -969,6 +969,7 @@ void Bot::checkMsgQueue () {
if (state == BotMsg::None || (state == BotMsg::Radio && game.is (GameFlags::FreeForAll))) { if (state == BotMsg::None || (state == BotMsg::Radio && game.is (GameFlags::FreeForAll))) {
return; return;
} }
float delayResponseTime = 0.0f;
switch (state) { switch (state) {
case BotMsg::Buy: // general buy message case BotMsg::Buy: // general buy message
@ -1038,11 +1039,14 @@ void Bot::checkMsgQueue () {
break; break;
case BotMsg::Radio: case BotMsg::Radio:
// if last bot radio command (global) happened just a 3 seconds ago, delay response delayResponseTime = rg (1.0f, 3.0f);
if (bots.getLastRadioTimestamp (m_team) + 3.0f < game.time ()) {
// if last bot radio command (global) happened some a little time ago, delay response
if (bots.getLastRadioTimestamp (m_team) + delayResponseTime < game.time ()) {
// if same message like previous just do a yes/no // if same message like previous just do a yes/no
if (m_radioSelect != Radio::RogerThat && m_radioSelect != Radio::Negative) { if (m_radioSelect != Radio::RogerThat && m_radioSelect != Radio::Negative) {
if (m_radioSelect == bots.getLastRadio (m_team) && bots.getLastRadioTimestamp (m_team) + 1.5f > game.time ()) { if (m_radioSelect == bots.getLastRadio (m_team) && bots.getLastRadioTimestamp (m_team) + delayResponseTime * 0.5f > game.time ()) {
m_radioSelect = -1; m_radioSelect = -1;
} }
else { else {

View file

@ -1187,7 +1187,7 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int skin) {
m_currentWeapon = 0; // current weapon is not assigned at start m_currentWeapon = 0; // current weapon is not assigned at start
m_weaponType = WeaponType::None; // current weapon type is not assigned at start m_weaponType = WeaponType::None; // current weapon type is not assigned at start
m_voicePitch = rg (80, 115); // assign voice pitch m_voicePitch = rg (85, 115); // assign voice pitch
// copy them over to the temp level variables // copy them over to the temp level variables
m_agressionLevel = m_baseAgressionLevel; m_agressionLevel = m_baseAgressionLevel;

View file

@ -1239,6 +1239,11 @@ bool Bot::updateNavigation () {
} }
} }
// make sure reach exactly, if just lost on path
if (!m_lostReachableNodeTimer.elapsed ()) {
desiredDistanceSq = 0.0f;
}
// needs precise placement - check if we get past the point // needs precise placement - check if we get past the point
if (desiredDistanceSq < cr::sqrf (22.0f) if (desiredDistanceSq < cr::sqrf (22.0f)
&& nodeDistanceSq < cr::sqrf (30.0f) && nodeDistanceSq < cr::sqrf (30.0f)