Bots will now look at teammates and jump sometimes while in freezetime. So they will not look like a "soldiers". Related to #94.
This commit is contained in:
parent
4b035819cb
commit
97c942ce3d
3 changed files with 34 additions and 2 deletions
|
|
@ -639,6 +639,7 @@ private:
|
|||
float m_itemCheckTime; // time next search for items needs to be done
|
||||
float m_joinServerTime; // time when bot joined the game
|
||||
float m_playServerTime; // time bot spent in the game
|
||||
float m_changeViewTime; // timestamp to change look at while at freezetime
|
||||
|
||||
bool m_moveToGoal; // bot currently moving to goal??
|
||||
bool m_isStuck; // bot is stuck
|
||||
|
|
@ -823,6 +824,7 @@ private:
|
|||
void completeTask ();
|
||||
void executeTasks ();
|
||||
void trackEnemies ();
|
||||
void choiceFreezetimeEntity ();
|
||||
|
||||
void normal_ ();
|
||||
void spraypaint_ ();
|
||||
|
|
|
|||
|
|
@ -646,7 +646,7 @@ void Bot::updatePickups () {
|
|||
m_itemIgnore = ent;
|
||||
allowPickup = false;
|
||||
|
||||
if (!m_defendHostage && m_difficulty > 2 && rg.chance (30) && m_timeCamping + 15.0f < game.time ()) {
|
||||
if (!m_defendHostage && m_personality != Personality::Rusher && m_difficulty > 2 && rg.chance (15) && m_timeCamping + 15.0f < game.time ()) {
|
||||
int index = findDefendNode (origin);
|
||||
|
||||
startTask (Task::Camp, TaskPri::Camp, kInvalidNodeIndex, game.time () + rg.float_ (30.0f, 60.0f), true); // push camp task on to stack
|
||||
|
|
@ -769,7 +769,7 @@ void Bot::updatePickups () {
|
|||
m_itemIgnore = ent;
|
||||
allowPickup = false;
|
||||
|
||||
if (!m_defendedBomb && m_difficulty > 2 && rg.chance (75) && pev->health < 80) {
|
||||
if (!m_defendedBomb && m_difficulty > 2 && rg.chance (75) && pev->health < 60) {
|
||||
int index = findDefendNode (origin);
|
||||
|
||||
startTask (Task::Camp, TaskPri::Camp, kInvalidNodeIndex, game.time () + rg.float_ (30.0f, 70.0f), true); // push camp task on to stack
|
||||
|
|
@ -2943,12 +2943,41 @@ void Bot::update () {
|
|||
if (botMovement) {
|
||||
logic (); // execute main code
|
||||
}
|
||||
else if (pev->maxspeed < 10.0f) {
|
||||
choiceFreezetimeEntity ();
|
||||
}
|
||||
runMovement ();
|
||||
|
||||
// delay next execution
|
||||
m_updateTime = game.time () + m_updateInterval;
|
||||
}
|
||||
|
||||
void Bot::choiceFreezetimeEntity () {
|
||||
if (m_changeViewTime > game.time ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rg.chance (15)) {
|
||||
pev->button |= IN_JUMP;
|
||||
}
|
||||
Array <Bot *> teammates;
|
||||
|
||||
for (const auto &bot : bots) {
|
||||
if (bot->m_notKilled && bot->m_team == m_team && seesEntity (bot->pev->origin) && bot.get () != this) {
|
||||
teammates.push (bot.get ());
|
||||
}
|
||||
}
|
||||
|
||||
if (!teammates.empty ()) {
|
||||
auto bot = teammates.random ();
|
||||
|
||||
if (bot) {
|
||||
m_lookAt = bot->pev->origin + bot->pev->view_ofs;
|
||||
}
|
||||
}
|
||||
m_changeViewTime = game.time () + rg.float_ (1.25, 2.0f);
|
||||
}
|
||||
|
||||
void Bot::normal_ () {
|
||||
m_aimFlags |= AimFlags::Nav;
|
||||
|
||||
|
|
|
|||
|
|
@ -1111,6 +1111,7 @@ void Bot::newRound () {
|
|||
m_prevOrigin = Vector (kInfiniteDistance, kInfiniteDistance, kInfiniteDistance);
|
||||
m_prevTime = game.time ();
|
||||
m_lookUpdateTime = game.time ();
|
||||
m_changeViewTime = game.time () + (rg.chance (25) ? mp_freezetime.float_ () : 0.0f);
|
||||
m_aimErrorTime = game.time ();
|
||||
|
||||
m_viewDistance = 4096.0f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue