fix: try bots jittering between walls (ref #620)
fix: more tweaks to bot's don't attack with knife problem (ref #617)
This commit is contained in:
parent
ed64062098
commit
21db11d071
2 changed files with 11 additions and 4 deletions
|
|
@ -1396,6 +1396,7 @@ void Bot::attackMovement () {
|
||||||
if (!game.is (GameFlags::CSDM)) {
|
if (!game.is (GameFlags::CSDM)) {
|
||||||
if ((m_states & Sense::SeeingEnemy)
|
if ((m_states & Sense::SeeingEnemy)
|
||||||
&& approach < 30
|
&& approach < 30
|
||||||
|
&& !isKnifeMode ()
|
||||||
&& !bots.isBombPlanted ()
|
&& !bots.isBombPlanted ()
|
||||||
&& (isInViewCone (m_enemy->v.origin) || m_isVIP)) {
|
&& (isInViewCone (m_enemy->v.origin) || m_isVIP)) {
|
||||||
|
|
||||||
|
|
@ -1540,6 +1541,12 @@ void Bot::attackMovement () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// do not move if inside "corridor"
|
||||||
|
if (wallOnRight && wallOnLeft) {
|
||||||
|
m_strafeSpeed = 0.0f;
|
||||||
|
m_strafeSetTime = game.time () + 3.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// we're setting strafe speed regardless of move angles, so not resetting forward move here cause bots to behave strange
|
// we're setting strafe speed regardless of move angles, so not resetting forward move here cause bots to behave strange
|
||||||
if (!usesKnife () && approach >= 30) {
|
if (!usesKnife () && approach >= 30) {
|
||||||
m_moveSpeed = 0.0f;
|
m_moveSpeed = 0.0f;
|
||||||
|
|
|
||||||
|
|
@ -3005,7 +3005,7 @@ bool Bot::isBlockedRight () {
|
||||||
|
|
||||||
bool Bot::checkWallOnLeft () {
|
bool Bot::checkWallOnLeft () {
|
||||||
TraceResult tr {};
|
TraceResult tr {};
|
||||||
game.testLine (pev->origin, pev->origin - pev->angles.right () * 52.0f, TraceIgnore::Monsters, ent (), &tr);
|
game.testLine (pev->origin, pev->origin - pev->angles.right () * 40.0f, TraceIgnore::Monsters, ent (), &tr);
|
||||||
|
|
||||||
// check if the trace hit something...
|
// check if the trace hit something...
|
||||||
if (tr.flFraction < 1.0f) {
|
if (tr.flFraction < 1.0f) {
|
||||||
|
|
@ -3018,7 +3018,7 @@ bool Bot::checkWallOnRight () {
|
||||||
TraceResult tr {};
|
TraceResult tr {};
|
||||||
|
|
||||||
// do a trace to the right...
|
// do a trace to the right...
|
||||||
game.testLine (pev->origin, pev->origin + pev->angles.right () * 52.0f, TraceIgnore::Monsters, ent (), &tr);
|
game.testLine (pev->origin, pev->origin + pev->angles.right () * 40.0f, TraceIgnore::Monsters, ent (), &tr);
|
||||||
|
|
||||||
// check if the trace hit something...
|
// check if the trace hit something...
|
||||||
if (tr.flFraction < 1.0f) {
|
if (tr.flFraction < 1.0f) {
|
||||||
|
|
@ -3031,7 +3031,7 @@ bool Bot::checkWallOnBehind () {
|
||||||
TraceResult tr {};
|
TraceResult tr {};
|
||||||
|
|
||||||
// do a trace to the right...
|
// do a trace to the right...
|
||||||
game.testLine (pev->origin, pev->origin - pev->angles.forward () * 52.0f, TraceIgnore::Monsters, ent (), &tr);
|
game.testLine (pev->origin, pev->origin - pev->angles.forward () * 40.0f, TraceIgnore::Monsters, ent (), &tr);
|
||||||
|
|
||||||
// check if the trace hit something...
|
// check if the trace hit something...
|
||||||
if (tr.flFraction < 1.0f) {
|
if (tr.flFraction < 1.0f) {
|
||||||
|
|
@ -3041,7 +3041,7 @@ bool Bot::checkWallOnBehind () {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Bot::isDeadlyMove (const Vector &to) {
|
bool Bot::isDeadlyMove (const Vector &to) {
|
||||||
// this function eturns if given location would hurt Bot with falling damage
|
// this function returns if given location would hurt Bot with falling damage
|
||||||
|
|
||||||
TraceResult tr {};
|
TraceResult tr {};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue