Changes to stuck handling that should result in fewer actually stuck npcs

This commit is contained in:
KimLS 2018-05-12 22:16:50 -07:00
parent eb463eef97
commit 66aaa92bd1

View File

@ -190,10 +190,22 @@ glm::vec3 Mob::HandleStuckPath(const glm::vec3 &To, const glm::vec3 &From)
auto r = zone->pathing->FindRoute(To, From, partial, stuck);
Route.clear();
auto final_node = r.back();
Route.push_back(final_node);
AdjustRoute(Route, flymode, GetZOffset());
return (*Route.begin()).pos;
if (r.size() < 1) {
Teleport(To);
return To;
}
auto iter = r.rbegin();
auto final_node = (*iter);
Teleport(final_node.pos);
if (r.size() < 2) {
return final_node.pos;
}
else {
iter++;
return (*iter).pos;
}
}
void CullPoints(std::vector<FindPerson_Point> &points) {