fix: texts have been corrected. (#477)

task: normal: skip sniper node if no sniper weapon.
task: normal: don't walk if there are no enemies left and they are using knives.
task: attack: get proper function if bots lose close node after attack task.
nav: unnecessary codes cleared.
combat: attack movements reviewed.
bot: enemy hearing is now better. (thanks for the @spodlesniy idea)
desire: increased desire to seek cover by distance. (made for zombie plague mod)
---------
Co-authored-by: jeefo <jeefo@rwsh.ru>
This commit is contained in:
commandcobra7 2023-09-10 11:12:15 +03:00 committed by GitHub
commit ae9beff151
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 92 additions and 84 deletions

View file

@ -1161,11 +1161,14 @@ void Bot::attackMovement () {
else if (usesRifle () || usesSubmachine () || usesHeavy ()) {
const int rand = rg.get (1, 100);
if (distance < 500.0f) {
if (distance < 768.0f) {
m_fightStyle = Fight::Strafe;
}
else if (distance < 1024.0f) {
if (rand < (usesSubmachine () ? 50 : 30)) {
if (isGroupOfEnemies (m_enemy->v.origin)) {
m_fightStyle = Fight::Strafe;
}
else if (rand < (usesSubmachine () ? 50 : 30)) {
m_fightStyle = Fight::Strafe;
}
else {
@ -1173,7 +1176,10 @@ void Bot::attackMovement () {
}
}
else {
if (rand < (usesSubmachine () ? 80 : 90)) {
if (isGroupOfEnemies (m_enemy->v.origin)) {
m_fightStyle = Fight::Strafe;
}
else if (rand < (usesSubmachine () ? 80 : 90)) {
m_fightStyle = Fight::Stay;
}
else {
@ -1199,9 +1205,12 @@ void Bot::attackMovement () {
m_moveSpeed = -pev->maxspeed;
}
if (usesKnife ()) {
m_fightStyle = Fight::None;
m_lastFightStyleCheck = game.time ();
if (usesKnife () && isInViewCone (m_enemy->v.origin)) {
m_fightStyle = Fight::Strafe;
}
if (usesPistol () && distance < 768.0f) {
m_fightStyle = Fight::Strafe;
}
if (m_fightStyle == Fight::Strafe) {
@ -1270,7 +1279,7 @@ void Bot::attackMovement () {
}
// do not move forward/backward is too far
if (distance > 1024.0) {
if (distance > 1024.0f) {
m_moveSpeed = 0.0f;
}
}
@ -1280,7 +1289,7 @@ void Bot::attackMovement () {
if (alreadyDucking) {
m_duckTime = game.time () + m_frameInterval * 2.0f;
}
else if ((distance > kDoubleSprayDistance && hasPrimaryWeapon ()) && (m_enemyParts & (Visibility::Head | Visibility::Body)) && getCurrentTaskId () != Task::SeekCover && getCurrentTaskId () != Task::Hunt) {
else if ((distance > 768.0f && hasPrimaryWeapon ()) && (m_enemyParts & (Visibility::Head | Visibility::Body)) && getCurrentTaskId () != Task::SeekCover && getCurrentTaskId () != Task::Hunt) {
const int enemyNearestIndex = graph.getNearest (m_enemy->v.origin);
if (vistab.visible (m_currentNodeIndex, enemyNearestIndex, VisIndex::Crouch) && vistab.visible (enemyNearestIndex, m_currentNodeIndex, VisIndex::Crouch)) {
@ -1293,7 +1302,7 @@ void Bot::attackMovement () {
if (m_difficulty >= Difficulty::Normal && isOnFloor () && m_duckTime < game.time ()) {
if (distance < 768.0f) {
if (rg.get (0, 1000) < rg.get (7, 12) && pev->velocity.length2d () > 150.0f && isInViewCone (m_enemy->v.origin)) {
if (rg.get (0, 1000) < rg.get (5, 10) && pev->velocity.length2d () > 150.0f && isInViewCone (m_enemy->v.origin)) {
pev->button |= IN_JUMP;
}
}
@ -1308,7 +1317,7 @@ void Bot::attackMovement () {
Vector right, forward;
pev->v_angle.angleVectors (&forward, &right, nullptr);
const auto &front = right * m_moveSpeed * 0.2f;
const auto &front = forward * m_moveSpeed * 0.2f;
const auto &side = right * m_strafeSpeed * 0.2f;
const auto &spot = pev->origin + front + side + pev->velocity * m_frameInterval;
@ -1907,7 +1916,7 @@ void Bot::checkGrenadesThrow () {
const float radius = cr::max (192.0f, m_lastEnemy->v.velocity.length2d ());
const Vector &pos = m_lastEnemy->v.velocity.get2d () + m_lastEnemy->v.origin;
auto predicted = graph.getNarestInRadius (radius, pos, 12);
auto predicted = graph.getNearestInRadius (radius, pos, 12);
if (predicted.empty ()) {
m_states &= ~Sense::ThrowExplosive;