Do not react on enemies while climbing ladders instead of jumping from them. #119
Do not test for bad primary weapon, if we have no secondary at all. #119
This commit is contained in:
parent
2aba34a24b
commit
d3dff431c6
3 changed files with 10 additions and 13 deletions
|
|
@ -2176,7 +2176,7 @@ bool Bot::reactOnEnemy () {
|
||||||
auto lineDist = (m_enemy->v.origin - pev->origin).length ();
|
auto lineDist = (m_enemy->v.origin - pev->origin).length ();
|
||||||
auto pathDist = static_cast <float> (graph.getPathDist (ownIndex, enemyIndex));
|
auto pathDist = static_cast <float> (graph.getPathDist (ownIndex, enemyIndex));
|
||||||
|
|
||||||
if (pathDist - lineDist > 112.0f) {
|
if (pathDist - lineDist > 112.0f || isOnLadder ()) {
|
||||||
m_isEnemyReachable = false;
|
m_isEnemyReachable = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -3444,11 +3444,6 @@ void Bot::attackEnemy_ () {
|
||||||
|
|
||||||
if (!game.isNullEntity (m_enemy)) {
|
if (!game.isNullEntity (m_enemy)) {
|
||||||
ignoreCollision ();
|
ignoreCollision ();
|
||||||
|
|
||||||
if (isOnLadder ()) {
|
|
||||||
pev->button |= IN_JUMP;
|
|
||||||
clearSearchNodes ();
|
|
||||||
}
|
|
||||||
attackMovement ();
|
attackMovement ();
|
||||||
|
|
||||||
if (m_currentWeapon == Weapon::Knife && !m_lastEnemyOrigin.empty ()) {
|
if (m_currentWeapon == Weapon::Knife && !m_lastEnemyOrigin.empty ()) {
|
||||||
|
|
|
||||||
|
|
@ -945,7 +945,7 @@ bool Bot::isWeaponBadAtDistance (int weaponIndex, float distance) {
|
||||||
|
|
||||||
auto &info = conf.getWeapons ();
|
auto &info = conf.getWeapons ();
|
||||||
|
|
||||||
if (m_difficulty < 2) {
|
if (m_difficulty < 2 || !hasSecondaryWeapon ()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int wid = info[weaponIndex].id;
|
int wid = info[weaponIndex].id;
|
||||||
|
|
|
||||||
|
|
@ -2673,16 +2673,18 @@ void BotGraph::eraseFromDisk () {
|
||||||
// this function removes graph file from the hard disk
|
// this function removes graph file from the hard disk
|
||||||
|
|
||||||
StringArray forErase;
|
StringArray forErase;
|
||||||
const char *map = game.getMapName ();
|
|
||||||
|
auto map = game.getMapName ();
|
||||||
|
auto data = getDataDirectory ();
|
||||||
|
|
||||||
bots.kickEveryone (true);
|
bots.kickEveryone (true);
|
||||||
|
|
||||||
// if we're delete graph, delete all corresponding to it files
|
// if we're delete graph, delete all corresponding to it files
|
||||||
forErase.push (strings.format ("%s%s.pwf", getDataDirectory (), map)); // graph itself
|
forErase.push (strings.format ("%s%s.pwf", data, map)); // graph itself
|
||||||
forErase.push (strings.format ("%slearned/%s.exp", getDataDirectory (), map)); // corresponding to practice
|
forErase.push (strings.format ("%slearned/%s.exp", data, map)); // corresponding to practice
|
||||||
forErase.push (strings.format ("%slearned/%s.vis", getDataDirectory (), map)); // corresponding to vistable
|
forErase.push (strings.format ("%slearned/%s.vis", data, map)); // corresponding to vistable
|
||||||
forErase.push (strings.format ("%slearned/%s.pmx", getDataDirectory (), map)); // corresponding to matrix
|
forErase.push (strings.format ("%slearned/%s.pmx", data, map)); // corresponding to matrix
|
||||||
forErase.push (strings.format ("%sgraph/%s.graph", getDataDirectory (), map)); // new format graph
|
forErase.push (strings.format ("%sgraph/%s.graph", data, map)); // new format graph
|
||||||
|
|
||||||
for (const auto &item : forErase) {
|
for (const auto &item : forErase) {
|
||||||
if (File::exists (item)) {
|
if (File::exists (item)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue