mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 15:58:36 +00:00
Add pathfinding interfaces, still heavily wip
This commit is contained in:
+14
-11
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user