diff --git a/src/control.cpp b/src/control.cpp index d11de7c..a674e36 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -2204,6 +2204,7 @@ BotControl::BotControl () { m_ent = nullptr; m_djump = nullptr; + m_denyCommands = true; m_ignoreTranslate = false; m_isFromConsole = false; m_isMenuFillCommand = false; diff --git a/src/manager.cpp b/src/manager.cpp index d4db87b..a1c3d3d 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -628,7 +628,9 @@ void BotManager::kickEveryone (bool instant, bool zeroQuota) { if (instant) { for (const auto &bot : m_bots) { - bot->kick (true); + if (!game.isNullEntity (bot->ent ())) { + bot->kick (true); + } } } m_addRequests.clear (); @@ -2330,5 +2332,17 @@ bool BotManager::isFrameSkipDisabled () { if (game.is (GameFlags::Legacy)) { return true; } - return game.is (GameFlags::Xash3D) && cv_think_fps_disable; + + if (game.is (GameFlags::Xash3D) && cv_think_fps_disable) { + static ConVarRef sys_ticrate ("sys_ticrate"); + + // ignore think_fps_disable if fps is more than 100 on xash dedicated server + if (game.isDedicated () && sys_ticrate.value () > 100.0f) { + cv_think_fps_disable.set (0); + + return false; + } + return true; + } + return false; } diff --git a/src/navigate.cpp b/src/navigate.cpp index 4b97da7..551caca 100644 --- a/src/navigate.cpp +++ b/src/navigate.cpp @@ -3449,6 +3449,11 @@ void Bot::findShortestPath (int srcIndex, int destIndex) { void Bot::syncFindPath (int srcIndex, int destIndex, FindPath pathType) { // this function finds a path from srcIndex to destIndex; + // stale bots shouldn't do pathfinding + if (m_isStale) { + return; + } + if (!m_pathFindLock.tryLock ()) { return; // allow only single instance of syncFindPath per-bot } @@ -3524,7 +3529,7 @@ void Bot::syncFindPath (int srcIndex, int destIndex, FindPath pathType) { m_chosenGoalIndex = srcIndex; m_goalValue = 0.0f; - auto result = m_planner->find (m_team, srcIndex, destIndex, [this] (int index) { + const auto result = m_planner->find (m_team, srcIndex, destIndex, [this] (int index) { m_pathWalk.add (index); return true; });