From 2b27b90f25dd46dd3d2b43ec5cdf01d20b18201e Mon Sep 17 00:00:00 2001 From: RGreenlees Date: Thu, 30 May 2024 14:19:01 +0100 Subject: [PATCH] Stuck fixes * Hopefully fixed issue that caused bots to get stuck in the tubes in Ragnarok --- main/source/mod/AvHAINavigation.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/main/source/mod/AvHAINavigation.cpp b/main/source/mod/AvHAINavigation.cpp index ba37bf56..fcb9ddbb 100644 --- a/main/source/mod/AvHAINavigation.cpp +++ b/main/source/mod/AvHAINavigation.cpp @@ -7555,7 +7555,31 @@ void BotFollowPath(AvHAIPlayer* pBot) bot_path_node CurrentNode = pBot->BotNavInfo.CurrentPath[pBot->BotNavInfo.CurrentPathPoint]; - if (IsPlayerStandingOnPlayer(pBot->Edict) && CurrentNode.flag != SAMPLE_POLYFLAGS_WALLCLIMB && CurrentNode.flag != SAMPLE_POLYFLAGS_LADDER) + if (CurrentNode.flag == SAMPLE_POLYFLAGS_LADDER || CurrentNode.flag == SAMPLE_POLYFLAGS_WALLCLIMB) + { + vector TeamMates = AIMGR_GetAllPlayersOnTeam(pBot->Player->GetTeam()); + + for (auto it = TeamMates.begin(); it != TeamMates.end(); it++) + { + AvHPlayer* ThisPlayer = (*it); + + if (ThisPlayer == pBot->Player) { continue; } + + if (ThisPlayer->pev->groundentity == pBot->Edict) + { + // If we have a point we can go back to, and we can reach it, then go for it. Otherwise, keep pushing on and hope the other guy moves + if (!vIsZero(pBot->BotNavInfo.LastOpenLocation)) + { + if (UTIL_PointIsReachable(pBot->BotNavInfo.NavProfile, pBot->Edict->v.origin, pBot->BotNavInfo.LastOpenLocation, GetPlayerRadius(pBot->Edict))) + { + NAV_SetMoveMovementTask(pBot, pBot->BotNavInfo.LastOpenLocation, nullptr); + return; + } + } + } + } + } + else if (IsPlayerStandingOnPlayer(pBot->Edict)) { Vector ForwardDir = UTIL_GetForwardVector2D(pBot->Edict->v.angles);