bot: do a real vector cleanup
This commit is contained in:
parent
4e8438a78b
commit
e8992f96b7
8 changed files with 89 additions and 66 deletions
|
|
@ -380,7 +380,6 @@ void GraphAnalyze::markGoals () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (game.mapIs (MapFlags::Demolition)) {
|
if (game.mapIs (MapFlags::Demolition)) {
|
||||||
updateNodeFlags (NodeFlag::Goal, "func_bomb_target"); // bombspot zone
|
updateNodeFlags (NodeFlag::Goal, "func_bomb_target"); // bombspot zone
|
||||||
updateNodeFlags (NodeFlag::Goal, "info_bomb_target"); // bombspot zone (same as above)
|
updateNodeFlags (NodeFlag::Goal, "info_bomb_target"); // bombspot zone (same as above)
|
||||||
|
|
|
||||||
|
|
@ -224,8 +224,8 @@ void Bot::checkBreakablesAround () {
|
||||||
// maybe time to give up?
|
// maybe time to give up?
|
||||||
if (m_lastBreakable == breakable && m_breakableTime + 1.0f < game.time ()) {
|
if (m_lastBreakable == breakable && m_breakableTime + 1.0f < game.time ()) {
|
||||||
m_ignoredBreakable.emplace (breakable);
|
m_ignoredBreakable.emplace (breakable);
|
||||||
|
m_breakableOrigin.clear ();
|
||||||
|
|
||||||
m_breakableOrigin = nullptr;
|
|
||||||
m_lastBreakable = nullptr;
|
m_lastBreakable = nullptr;
|
||||||
m_breakableEntity = nullptr;
|
m_breakableEntity = nullptr;
|
||||||
|
|
||||||
|
|
@ -274,7 +274,7 @@ edict_t *Bot::lookupBreakable () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_breakableEntity = nullptr;
|
m_breakableEntity = nullptr;
|
||||||
m_breakableOrigin = nullptr;
|
m_breakableOrigin.clear ();
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
@ -766,7 +766,6 @@ void Bot::ensurePickupEntitiesClear () {
|
||||||
if (tid == Task::PickupItem) {
|
if (tid == Task::PickupItem) {
|
||||||
completeTask ();
|
completeTask ();
|
||||||
}
|
}
|
||||||
|
|
||||||
findValidNode ();
|
findValidNode ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -791,9 +790,9 @@ Vector Bot::getCampDirection (const Vector &dest) {
|
||||||
|
|
||||||
// check if the trace hit something...
|
// check if the trace hit something...
|
||||||
if (tr.flFraction < 1.0f) {
|
if (tr.flFraction < 1.0f) {
|
||||||
const float lengthSq = tr.vecEndPos.distanceSq (src);
|
const float distanceSq = tr.vecEndPos.distanceSq (src);
|
||||||
|
|
||||||
if (lengthSq > cr::sqrf (1024.0f)) {
|
if (distanceSq > cr::sqrf (1024.0f)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1614,6 +1613,14 @@ void Bot::updateEmotions () {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_seeEnemyTime + 1.0f > game.time ()) {
|
||||||
|
m_agressionLevel += 0.05f;
|
||||||
|
|
||||||
|
if (m_agressionLevel > 1.0f) {
|
||||||
|
m_agressionLevel = 1.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_seeEnemyTime + 5.0f < game.time ()) {
|
||||||
if (m_agressionLevel > m_baseAgressionLevel) {
|
if (m_agressionLevel > m_baseAgressionLevel) {
|
||||||
m_agressionLevel -= 0.05f;
|
m_agressionLevel -= 0.05f;
|
||||||
}
|
}
|
||||||
|
|
@ -1628,6 +1635,14 @@ void Bot::updateEmotions () {
|
||||||
m_fearLevel += 0.05f;
|
m_fearLevel += 0.05f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_agressionLevel > 1.0f) {
|
||||||
|
m_agressionLevel = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_fearLevel > 1.0f) {
|
||||||
|
m_fearLevel = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_agressionLevel < 0.0f) {
|
if (m_agressionLevel < 0.0f) {
|
||||||
m_agressionLevel = 0.0f;
|
m_agressionLevel = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
@ -1635,7 +1650,8 @@ void Bot::updateEmotions () {
|
||||||
if (m_fearLevel < 0.0f) {
|
if (m_fearLevel < 0.0f) {
|
||||||
m_fearLevel = 0.0f;
|
m_fearLevel = 0.0f;
|
||||||
}
|
}
|
||||||
m_nextEmotionUpdate = game.time () + 1.0f;
|
}
|
||||||
|
m_nextEmotionUpdate = game.time () + 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::overrideConditions () {
|
void Bot::overrideConditions () {
|
||||||
|
|
@ -1918,12 +1934,12 @@ void Bot::setConditions () {
|
||||||
// don't listen if seeing enemy, just checked for sounds or being blinded (because its inhuman)
|
// don't listen if seeing enemy, just checked for sounds or being blinded (because its inhuman)
|
||||||
if (m_soundUpdateTime < game.time ()
|
if (m_soundUpdateTime < game.time ()
|
||||||
&& m_blindTime < game.time ()
|
&& m_blindTime < game.time ()
|
||||||
&& m_seeEnemyTime + 1.0f < game.time ()) {
|
&& m_seeEnemyTime + 0.5f < game.time ()) {
|
||||||
|
|
||||||
updateHearing ();
|
updateHearing ();
|
||||||
m_soundUpdateTime = game.time () + 0.25f;
|
m_soundUpdateTime = game.time () + 0.05f;
|
||||||
}
|
}
|
||||||
else if (m_heardSoundTime + 10.0f < game.time ()) {
|
else if (m_soundUpdateTime >= game.time () && m_heardSoundTime + 10.0f < game.time ()) {
|
||||||
m_states &= ~Sense::HearingEnemy;
|
m_states &= ~Sense::HearingEnemy;
|
||||||
|
|
||||||
// clear the last enemy pointers if time has passed or enemy far away
|
// clear the last enemy pointers if time has passed or enemy far away
|
||||||
|
|
@ -1931,7 +1947,7 @@ void Bot::setConditions () {
|
||||||
const auto distanceSq = pev->origin.distanceSq (m_lastEnemyOrigin);
|
const auto distanceSq = pev->origin.distanceSq (m_lastEnemyOrigin);
|
||||||
|
|
||||||
if (distanceSq > cr::sqrf (2048.0f) || (game.isNullEntity (m_enemy) && m_seeEnemyTime + 10.0f < game.time ())) {
|
if (distanceSq > cr::sqrf (2048.0f) || (game.isNullEntity (m_enemy) && m_seeEnemyTime + 10.0f < game.time ())) {
|
||||||
m_lastEnemyOrigin = nullptr;
|
m_lastEnemyOrigin.clear ();
|
||||||
m_lastEnemy = nullptr;
|
m_lastEnemy = nullptr;
|
||||||
|
|
||||||
m_aimFlags &= ~AimFlags::LastEnemy;
|
m_aimFlags &= ~AimFlags::LastEnemy;
|
||||||
|
|
@ -3327,8 +3343,9 @@ void Bot::logic () {
|
||||||
m_strafeSpeed = pev->maxspeed * static_cast <float> (m_needAvoidGrenade);
|
m_strafeSpeed = pev->maxspeed * static_cast <float> (m_needAvoidGrenade);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure we're not stuck destroying/picking something
|
// ensure we're not stuck picking something
|
||||||
if (m_moveToGoal && m_moveSpeed > 0.0f && rg (2.5f, 3.5f) + m_navTimeset + m_destOrigin.distanceSq2d (pev->origin) / cr::sqrf (m_moveSpeed) < game.time ()
|
if (m_moveToGoal && m_moveSpeed > 0.0f
|
||||||
|
&& rg (2.5f, 3.5f) + m_navTimeset + m_destOrigin.distanceSq2d (pev->origin) / cr::sqrf (m_moveSpeed) < game.time ()
|
||||||
&& !(m_states & Sense::SeeingEnemy)) {
|
&& !(m_states & Sense::SeeingEnemy)) {
|
||||||
ensurePickupEntitiesClear ();
|
ensurePickupEntitiesClear ();
|
||||||
}
|
}
|
||||||
|
|
@ -3772,7 +3789,7 @@ void Bot::resetDoubleJump () {
|
||||||
|
|
||||||
m_doubleJumpEntity = nullptr;
|
m_doubleJumpEntity = nullptr;
|
||||||
m_duckForJump = 0.0f;
|
m_duckForJump = 0.0f;
|
||||||
m_doubleJumpOrigin = nullptr;
|
m_doubleJumpOrigin.clear ();
|
||||||
m_travelStartIndex = kInvalidNodeIndex;
|
m_travelStartIndex = kInvalidNodeIndex;
|
||||||
m_jumpReady = false;
|
m_jumpReady = false;
|
||||||
}
|
}
|
||||||
|
|
@ -4043,7 +4060,7 @@ void Bot::updateHearing () {
|
||||||
// if bot had an enemy but the heard one is nearer, take it instead
|
// if bot had an enemy but the heard one is nearer, take it instead
|
||||||
const float distanceSq = m_lastEnemyOrigin.distanceSq (pev->origin);
|
const float distanceSq = m_lastEnemyOrigin.distanceSq (pev->origin);
|
||||||
|
|
||||||
if (distanceSq > m_hearedEnemy->v.origin.distanceSq (pev->origin) && m_seeEnemyTime + 2.0f < game.time ()) {
|
if (distanceSq > m_hearedEnemy->v.origin.distanceSq (pev->origin) && m_seeEnemyTime + 1.0f < game.time ()) {
|
||||||
m_lastEnemy = m_hearedEnemy;
|
m_lastEnemy = m_hearedEnemy;
|
||||||
m_lastEnemyOrigin = getHeardOriginWithError ();
|
m_lastEnemyOrigin = getHeardOriginWithError ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ bool Bot::checkBodyParts (edict_t *target) {
|
||||||
|
|
||||||
if (isEnemyHidden (target) || isEnemyInvincible (target) || isEnemyNoTarget (target)) {
|
if (isEnemyHidden (target) || isEnemyInvincible (target) || isEnemyNoTarget (target)) {
|
||||||
m_enemyParts = Visibility::None;
|
m_enemyParts = Visibility::None;
|
||||||
m_enemyOrigin = nullptr;
|
m_enemyOrigin.clear ();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -360,7 +360,7 @@ bool Bot::lookupEnemies () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_enemyParts = Visibility::None;
|
m_enemyParts = Visibility::None;
|
||||||
m_enemyOrigin = nullptr;
|
m_enemyOrigin.clear ();
|
||||||
|
|
||||||
if (!game.isNullEntity (m_enemy)) {
|
if (!game.isNullEntity (m_enemy)) {
|
||||||
player = m_enemy;
|
player = m_enemy;
|
||||||
|
|
@ -666,7 +666,7 @@ Vector Bot::getEnemyBodyOffset () {
|
||||||
compensation.z = 0.0f;
|
compensation.z = 0.0f;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
compensation = nullptr;
|
compensation.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we only suspect an enemy behind a wall take the worst skill
|
// if we only suspect an enemy behind a wall take the worst skill
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@ void BotGraph::reset () {
|
||||||
m_editFlags = 0;
|
m_editFlags = 0;
|
||||||
m_autoSaveCount = 0;
|
m_autoSaveCount = 0;
|
||||||
|
|
||||||
m_learnVelocity = nullptr;
|
m_learnVelocity.clear ();
|
||||||
m_learnPosition = nullptr;
|
m_learnPosition.clear ();
|
||||||
m_lastNode = nullptr;
|
m_lastNode.clear ();
|
||||||
|
|
||||||
m_pathDisplayTime = 0.0f;
|
m_pathDisplayTime = 0.0f;
|
||||||
m_arrowDisplayTime = 0.0f;
|
m_arrowDisplayTime = 0.0f;
|
||||||
|
|
@ -714,8 +714,8 @@ void BotGraph::add (int type, const Vector &pos) {
|
||||||
|
|
||||||
// store the origin (location) of this node
|
// store the origin (location) of this node
|
||||||
path->origin = newOrigin;
|
path->origin = newOrigin;
|
||||||
path->start = nullptr;
|
path->start.clear ();
|
||||||
path->end = nullptr;
|
path->end.clear ();
|
||||||
|
|
||||||
path->display = 0.0f;
|
path->display = 0.0f;
|
||||||
path->light = kInvalidLightLevel;
|
path->light = kInvalidLightLevel;
|
||||||
|
|
@ -724,7 +724,7 @@ void BotGraph::add (int type, const Vector &pos) {
|
||||||
link.index = kInvalidNodeIndex;
|
link.index = kInvalidNodeIndex;
|
||||||
link.distance = 0;
|
link.distance = 0;
|
||||||
link.flags = 0;
|
link.flags = 0;
|
||||||
link.velocity = nullptr;
|
link.velocity.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// autosave nodes here and there
|
// autosave nodes here and there
|
||||||
|
|
@ -931,7 +931,7 @@ void BotGraph::erase (int target) {
|
||||||
link.index = kInvalidNodeIndex;
|
link.index = kInvalidNodeIndex;
|
||||||
link.flags = 0;
|
link.flags = 0;
|
||||||
link.distance = 0;
|
link.distance = 0;
|
||||||
link.velocity = nullptr;
|
link.velocity.clear ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1131,7 +1131,7 @@ void BotGraph::erasePath () {
|
||||||
link.index = kInvalidNodeIndex;
|
link.index = kInvalidNodeIndex;
|
||||||
link.distance = 0;
|
link.distance = 0;
|
||||||
link.flags = 0;
|
link.flags = 0;
|
||||||
link.velocity = nullptr;
|
link.velocity.clear ();
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto &link : m_paths[nodeFrom].links) {
|
for (auto &link : m_paths[nodeFrom].links) {
|
||||||
|
|
@ -1174,7 +1174,7 @@ void BotGraph::resetPath (int index) {
|
||||||
link.index = kInvalidNodeIndex;
|
link.index = kInvalidNodeIndex;
|
||||||
link.distance = 0;
|
link.distance = 0;
|
||||||
link.flags = 0;
|
link.flags = 0;
|
||||||
link.velocity = nullptr;
|
link.velocity.clear ();
|
||||||
};
|
};
|
||||||
|
|
||||||
// clean all incoming
|
// clean all incoming
|
||||||
|
|
@ -2712,7 +2712,7 @@ void BotGraph::setBombOrigin (bool reset, const Vector &pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reset) {
|
if (reset) {
|
||||||
m_bombOrigin = nullptr;
|
m_bombOrigin.clear ();
|
||||||
bots.setBombPlanted (false);
|
bots.setBombPlanted (false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -2736,7 +2736,7 @@ void BotGraph::setBombOrigin (bool reset, const Vector &pos) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!wasFound) {
|
if (!wasFound) {
|
||||||
m_bombOrigin = nullptr;
|
m_bombOrigin.clear ();
|
||||||
bots.setBombPlanted (false);
|
bots.setBombPlanted (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2828,7 +2828,7 @@ void BotGraph::unassignPath (int from, int to) {
|
||||||
link.index = kInvalidNodeIndex;
|
link.index = kInvalidNodeIndex;
|
||||||
link.distance = 0;
|
link.distance = 0;
|
||||||
link.flags = 0;
|
link.flags = 0;
|
||||||
link.velocity = nullptr;
|
link.velocity.clear ();
|
||||||
|
|
||||||
setEditFlag (GraphEdit::On);
|
setEditFlag (GraphEdit::On);
|
||||||
m_hasChanged = true;
|
m_hasChanged = true;
|
||||||
|
|
|
||||||
|
|
@ -1438,12 +1438,12 @@ void Bot::newRound () {
|
||||||
// delete all allocated path nodes
|
// delete all allocated path nodes
|
||||||
clearSearchNodes ();
|
clearSearchNodes ();
|
||||||
|
|
||||||
m_pathOrigin = nullptr;
|
m_pathOrigin.clear ();
|
||||||
m_destOrigin = nullptr;
|
m_destOrigin.clear ();
|
||||||
|
|
||||||
m_path = nullptr;
|
m_path = nullptr;
|
||||||
m_currentTravelFlags = 0;
|
m_currentTravelFlags = 0;
|
||||||
m_desiredVelocity = nullptr;
|
m_desiredVelocity.clear ();
|
||||||
m_currentNodeIndex = kInvalidNodeIndex;
|
m_currentNodeIndex = kInvalidNodeIndex;
|
||||||
m_prevGoalIndex = kInvalidNodeIndex;
|
m_prevGoalIndex = kInvalidNodeIndex;
|
||||||
m_chosenGoalIndex = kInvalidNodeIndex;
|
m_chosenGoalIndex = kInvalidNodeIndex;
|
||||||
|
|
@ -1497,13 +1497,13 @@ void Bot::newRound () {
|
||||||
m_ignoredItems.clear ();
|
m_ignoredItems.clear ();
|
||||||
|
|
||||||
m_breakableEntity = nullptr;
|
m_breakableEntity = nullptr;
|
||||||
m_breakableOrigin = nullptr;
|
m_breakableOrigin.clear ();
|
||||||
m_lastBreakable = nullptr;
|
m_lastBreakable = nullptr;
|
||||||
|
|
||||||
m_timeDoorOpen = 0.0f;
|
m_timeDoorOpen = 0.0f;
|
||||||
|
|
||||||
for (auto &fall : m_checkFallPoint) {
|
for (auto &fall : m_checkFallPoint) {
|
||||||
fall = nullptr;
|
fall.clear ();
|
||||||
}
|
}
|
||||||
m_checkFall = false;
|
m_checkFall = false;
|
||||||
|
|
||||||
|
|
@ -1513,8 +1513,8 @@ void Bot::newRound () {
|
||||||
m_enemy = nullptr;
|
m_enemy = nullptr;
|
||||||
m_lastVictim = nullptr;
|
m_lastVictim = nullptr;
|
||||||
m_lastEnemy = nullptr;
|
m_lastEnemy = nullptr;
|
||||||
m_lastEnemyOrigin = nullptr;
|
m_lastEnemyOrigin.clear ();
|
||||||
m_lastVictimOrigin = nullptr;
|
m_lastVictimOrigin.clear ();
|
||||||
m_trackingEdict = nullptr;
|
m_trackingEdict = nullptr;
|
||||||
m_enemyBodyPartSet = nullptr;
|
m_enemyBodyPartSet = nullptr;
|
||||||
m_timeNextTracking = 0.0f;
|
m_timeNextTracking = 0.0f;
|
||||||
|
|
@ -1539,9 +1539,9 @@ void Bot::newRound () {
|
||||||
m_aimFlags = 0;
|
m_aimFlags = 0;
|
||||||
m_liftState = 0;
|
m_liftState = 0;
|
||||||
|
|
||||||
m_aimLastError = nullptr;
|
m_aimLastError.clear ();
|
||||||
m_position = nullptr;
|
m_position.clear ();
|
||||||
m_liftTravelPos = nullptr;
|
m_liftTravelPos.clear ();
|
||||||
|
|
||||||
setIdealReactionTimers (true);
|
setIdealReactionTimers (true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -847,7 +847,7 @@ void Bot::checkFall () {
|
||||||
m_checkFallPoint[1] = m_pathOrigin;
|
m_checkFallPoint[1] = m_pathOrigin;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_checkFallPoint[1] = nullptr;
|
m_checkFallPoint[1].clear ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!isOnLadder () && !isInWater ()) {
|
else if (!isOnLadder () && !isInWater ()) {
|
||||||
|
|
@ -940,7 +940,7 @@ void Bot::resetMovement () {
|
||||||
|
|
||||||
m_moveSpeed = 0.0f;
|
m_moveSpeed = 0.0f;
|
||||||
m_strafeSpeed = 0.0f;
|
m_strafeSpeed = 0.0f;
|
||||||
m_moveAngles = nullptr;
|
m_moveAngles.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::translateInput () {
|
void Bot::translateInput () {
|
||||||
|
|
@ -1032,7 +1032,7 @@ bool Bot::updateNavigation () {
|
||||||
|
|
||||||
m_jumpFinished = true;
|
m_jumpFinished = true;
|
||||||
m_checkTerrain = false;
|
m_checkTerrain = false;
|
||||||
m_desiredVelocity = nullptr;
|
m_desiredVelocity.clear ();
|
||||||
|
|
||||||
// cool down a little if next path after current will be jump
|
// cool down a little if next path after current will be jump
|
||||||
if (m_jumpSequence) {
|
if (m_jumpSequence) {
|
||||||
|
|
@ -2474,7 +2474,7 @@ bool Bot::advanceMovement () {
|
||||||
// if height difference is enough, consider this link as jump link
|
// if height difference is enough, consider this link as jump link
|
||||||
if (graph[destIndex].origin.z > m_path->origin.z && diff > cv_graph_slope_height.as <float> ()) {
|
if (graph[destIndex].origin.z > m_path->origin.z && diff > cv_graph_slope_height.as <float> ()) {
|
||||||
m_currentTravelFlags |= PathFlag::Jump;
|
m_currentTravelFlags |= PathFlag::Jump;
|
||||||
m_desiredVelocity = nullptr; // make bot compute jump velocity
|
m_desiredVelocity.clear (); // make bot compute jump velocity
|
||||||
m_jumpFinished = false; // force-mark this path as jump
|
m_jumpFinished = false; // force-mark this path as jump
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,15 @@ void Bot::normal_ () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// bots rushing with knife, when have no enemy (thanks for idea to nicebot project)
|
// bots rushing with knife, when have no enemy (thanks for idea to nicebot project)
|
||||||
if (cv_random_knife_attacks && usesKnife () && (game.isNullEntity (m_lastEnemy) || !util.isAlive (m_lastEnemy)) && game.isNullEntity (m_enemy) && m_knifeAttackTime < game.time () && !m_hasHostage && !hasShield () && numFriendsNear (pev->origin, 96.0f) == 0) {
|
if (cv_random_knife_attacks
|
||||||
|
&& usesKnife ()
|
||||||
|
&& (game.isNullEntity (m_lastEnemy) || !util.isAlive (m_lastEnemy))
|
||||||
|
&& game.isNullEntity (m_enemy)
|
||||||
|
&& m_knifeAttackTime < game.time ()
|
||||||
|
&& !m_hasHostage
|
||||||
|
&& !hasShield ()
|
||||||
|
&& numFriendsNear (pev->origin, 96.0f) == 0) {
|
||||||
|
|
||||||
if (rg.chance (40)) {
|
if (rg.chance (40)) {
|
||||||
pev->button |= IN_ATTACK;
|
pev->button |= IN_ATTACK;
|
||||||
}
|
}
|
||||||
|
|
@ -255,7 +263,6 @@ void Bot::normal_ () {
|
||||||
ensureCurrentNodeIndex ();
|
ensureCurrentNodeIndex ();
|
||||||
|
|
||||||
// do pathfinding if it's not the current
|
// do pathfinding if it's not the current
|
||||||
|
|
||||||
if (destIndex != m_currentNodeIndex) {
|
if (destIndex != m_currentNodeIndex) {
|
||||||
findPath (m_currentNodeIndex, destIndex, pathSearchType);
|
findPath (m_currentNodeIndex, destIndex, pathSearchType);
|
||||||
}
|
}
|
||||||
|
|
@ -362,7 +369,7 @@ void Bot::huntEnemy_ () {
|
||||||
completeTask ();
|
completeTask ();
|
||||||
|
|
||||||
m_prevGoalIndex = kInvalidNodeIndex;
|
m_prevGoalIndex = kInvalidNodeIndex;
|
||||||
m_lastEnemyOrigin = nullptr;
|
m_lastEnemyOrigin.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// do we need to calculate a new path?
|
// do we need to calculate a new path?
|
||||||
|
|
@ -775,7 +782,7 @@ void Bot::moveToPos_ () {
|
||||||
completeTask (); // we're done
|
completeTask (); // we're done
|
||||||
|
|
||||||
m_prevGoalIndex = kInvalidNodeIndex;
|
m_prevGoalIndex = kInvalidNodeIndex;
|
||||||
m_position = nullptr;
|
m_position.clear ();
|
||||||
}
|
}
|
||||||
// didn't choose goal node yet?
|
// didn't choose goal node yet?
|
||||||
else if (!hasActiveGoal ()) {
|
else if (!hasActiveGoal ()) {
|
||||||
|
|
@ -920,7 +927,7 @@ void Bot::defuseBomb_ () {
|
||||||
|
|
||||||
// one of exceptions is thrown. finish task.
|
// one of exceptions is thrown. finish task.
|
||||||
if (defuseError) {
|
if (defuseError) {
|
||||||
m_entity = nullptr;
|
m_entity.clear ();
|
||||||
|
|
||||||
m_pickupItem = nullptr;
|
m_pickupItem = nullptr;
|
||||||
m_pickupType = Pickup::None;
|
m_pickupType = Pickup::None;
|
||||||
|
|
@ -1465,7 +1472,7 @@ void Bot::shootBreakable_ () {
|
||||||
m_checkTerrain = true;
|
m_checkTerrain = true;
|
||||||
m_moveToGoal = true;
|
m_moveToGoal = true;
|
||||||
|
|
||||||
m_breakableOrigin = nullptr;
|
m_breakableOrigin.clear ();
|
||||||
m_breakableEntity = nullptr;
|
m_breakableEntity = nullptr;
|
||||||
|
|
||||||
completeTask ();
|
completeTask ();
|
||||||
|
|
|
||||||
|
|
@ -499,7 +499,7 @@ void Bot::setAimDirection () {
|
||||||
m_aimFlags &= ~AimFlags::PredictPath;
|
m_aimFlags &= ~AimFlags::PredictPath;
|
||||||
|
|
||||||
m_trackingEdict = nullptr;
|
m_trackingEdict = nullptr;
|
||||||
m_lookAtPredict = nullptr;
|
m_lookAtPredict.clear ();
|
||||||
};
|
};
|
||||||
|
|
||||||
auto pathLength = m_lastPredictLength;
|
auto pathLength = m_lastPredictLength;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue