diff --git a/include/yapb.h b/include/yapb.h index eaf0e2b..feeb427 100644 --- a/include/yapb.h +++ b/include/yapb.h @@ -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_ (); diff --git a/source/basecode.cpp b/source/basecode.cpp index f458a40..b69c401 100644 --- a/source/basecode.cpp +++ b/source/basecode.cpp @@ -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 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; diff --git a/source/manager.cpp b/source/manager.cpp index df79c35..56f79ea 100644 --- a/source/manager.cpp +++ b/source/manager.cpp @@ -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;