nav: pause a little if doing jump sequence
This commit is contained in:
parent
7f4d4748fa
commit
57f5c1f323
3 changed files with 17 additions and 7 deletions
|
|
@ -764,6 +764,7 @@ private:
|
||||||
bool m_needToSendWelcomeChat {}; // bot needs to greet people on server?
|
bool m_needToSendWelcomeChat {}; // bot needs to greet people on server?
|
||||||
bool m_isCreature {}; // bot is not a player, but something else ? zombie ?
|
bool m_isCreature {}; // bot is not a player, but something else ? zombie ?
|
||||||
bool m_defuseNotified {}; // bot is notified about bomb defusion
|
bool m_defuseNotified {}; // bot is notified about bomb defusion
|
||||||
|
bool m_jumpSequence {}; // next path link will be jump link
|
||||||
|
|
||||||
Pickup m_pickupType {}; // type of entity which needs to be used/picked up
|
Pickup m_pickupType {}; // type of entity which needs to be used/picked up
|
||||||
PathWalk m_pathWalk {}; // pointer to current node from path
|
PathWalk m_pathWalk {}; // pointer to current node from path
|
||||||
|
|
|
||||||
|
|
@ -2773,14 +2773,8 @@ void Bot::executeTasks () {
|
||||||
auto func = getTask ()->func;
|
auto func = getTask ()->func;
|
||||||
|
|
||||||
// run the current task
|
// run the current task
|
||||||
if (func != nullptr) {
|
|
||||||
(this->*func) ();
|
(this->*func) ();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
logger.error ("Missing callback function of Task %d.", getCurrentTaskId ());
|
|
||||||
kick (); // drop the player, as it's fatal for bot
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Bot::checkSpawnConditions () {
|
void Bot::checkSpawnConditions () {
|
||||||
// this function is called instead of ai when buying finished, but freezetime is not yet left.
|
// this function is called instead of ai when buying finished, but freezetime is not yet left.
|
||||||
|
|
|
||||||
|
|
@ -875,6 +875,12 @@ bool Bot::updateNavigation () {
|
||||||
m_jumpFinished = true;
|
m_jumpFinished = true;
|
||||||
m_checkTerrain = false;
|
m_checkTerrain = false;
|
||||||
m_desiredVelocity = nullptr;
|
m_desiredVelocity = nullptr;
|
||||||
|
|
||||||
|
// cool down a little if next path after current will be jump
|
||||||
|
if (m_jumpSequence) {
|
||||||
|
startTask (Task::Pause, TaskPri::Pause, kInvalidNodeIndex, game.time () + rg.get (0.75, 1.2f) + m_frameInterval, false);
|
||||||
|
m_jumpSequence = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!cv_jasonmode.bool_ () && usesKnife () && isOnFloor ()) {
|
else if (!cv_jasonmode.bool_ () && usesKnife () && isOnFloor ()) {
|
||||||
|
|
@ -2201,7 +2207,10 @@ bool Bot::advanceMovement () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_pathWalk.empty ()) {
|
if (!m_pathWalk.empty ()) {
|
||||||
|
m_jumpSequence = false;
|
||||||
|
|
||||||
const int destIndex = m_pathWalk.first ();
|
const int destIndex = m_pathWalk.first ();
|
||||||
|
bool isCurrentJump = false;
|
||||||
|
|
||||||
// find out about connection flags
|
// find out about connection flags
|
||||||
if (destIndex != kInvalidNodeIndex && m_currentNodeIndex != kInvalidNodeIndex) {
|
if (destIndex != kInvalidNodeIndex && m_currentNodeIndex != kInvalidNodeIndex) {
|
||||||
|
|
@ -2211,6 +2220,7 @@ bool Bot::advanceMovement () {
|
||||||
m_desiredVelocity = link.velocity;
|
m_desiredVelocity = link.velocity;
|
||||||
m_jumpFinished = false;
|
m_jumpFinished = false;
|
||||||
|
|
||||||
|
isCurrentJump = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2242,6 +2252,11 @@ bool Bot::advanceMovement () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mark as jump sequence, if the current and next paths are jumps
|
||||||
|
if (isCurrentJump) {
|
||||||
|
m_jumpSequence = willJump;
|
||||||
|
}
|
||||||
|
|
||||||
// is there a jump node right ahead and do we need to draw out the light weapon ?
|
// is there a jump node right ahead and do we need to draw out the light weapon ?
|
||||||
if (willJump && !usesKnife () && m_currentWeapon != Weapon::Scout && !m_isReloading && !usesPistol () && (jumpDistance > 145.0f || (dst.z - 32.0f > src.z && jumpDistance > 125.0f)) && !(m_states & Sense::SeeingEnemy)) {
|
if (willJump && !usesKnife () && m_currentWeapon != Weapon::Scout && !m_isReloading && !usesPistol () && (jumpDistance > 145.0f || (dst.z - 32.0f > src.z && jumpDistance > 125.0f)) && !(m_states & Sense::SeeingEnemy)) {
|
||||||
selectWeaponById (Weapon::Knife); // draw out the knife if we needed
|
selectWeaponById (Weapon::Knife); // draw out the knife if we needed
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue