Add pathfinding interfaces, still heavily wip

This commit is contained in:
KimLS
2017-07-18 00:01:59 -07:00
parent 596e3b28b5
commit 5f1063acb9
26 changed files with 705 additions and 1181 deletions
+14 -11
View File
@@ -130,23 +130,25 @@ void Mob::CalculateNewFearpoint()
{
if(RuleB(Pathing, Fear) && zone->pathing)
{
int Node = zone->pathing->GetRandomPathNode();
auto Node = zone->pathing->GetRandomLocation();
if (Node.x != 0.0f || Node.y != 0.0f || Node.z != 0.0f) {
glm::vec3 Loc = zone->pathing->GetPathNodeCoordinates(Node);
++Node.z;
++Loc.z;
glm::vec3 CurrentPosition(GetX(), GetY(), GetZ());
glm::vec3 CurrentPosition(GetX(), GetY(), GetZ());
auto Route = zone->pathing->FindRoute(CurrentPosition, Node);
std::deque<int> Route = zone->pathing->FindRoute(CurrentPosition, Loc);
if (!Route.empty())
{
auto first = (*Route.begin());
m_FearWalkTarget = glm::vec3(first.x, first.y, first.z);
currently_fleeing = true;
if(!Route.empty())
{
m_FearWalkTarget = glm::vec3(Loc.x, Loc.y, Loc.z);
currently_fleeing = true;
Log(Logs::Detail, Logs::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, first.x, first.y, first.z);
return;
}
Log(Logs::Detail, Logs::None, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z);
return;
}
Log(Logs::Detail, Logs::None, "No path found to selected node. Falling through to old fear point selection.");
@@ -171,6 +173,7 @@ void Mob::CalculateNewFearpoint()
break;
}
}
if (currently_fleeing)
m_FearWalkTarget = glm::vec3(ranx, rany, ranz);
else //Break fear