mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-03 13:36:36 +00:00
Changed how i calc partial and broken paths
This commit is contained in:
+14
-17
@@ -4101,10 +4101,9 @@ void command_path(Client *c, const Seperator *sep)
|
||||
bool first = true;
|
||||
auto route = zone->pathing.FindRoute(src, dest);
|
||||
auto &nodes = route.GetNodes();
|
||||
auto &last_node = nodes[nodes.size() - 1];
|
||||
auto dist = DistanceSquared(glm::vec4(last_node.position, 1.0f), glm::vec4(dest.x, dest.y, dest.z, 0.0f));
|
||||
if (dist > 10000.0f) {
|
||||
c->Message(0, "Path from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) found with %i nodes, broken path, would need warp.",
|
||||
|
||||
if (route.GetStatus() == PathComplete) {
|
||||
c->Message(0, "Path from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) found with %i nodes, complete path.",
|
||||
src.x,
|
||||
src.y,
|
||||
src.z,
|
||||
@@ -4112,9 +4111,7 @@ void command_path(Client *c, const Seperator *sep)
|
||||
dest.y,
|
||||
dest.z,
|
||||
(int)nodes.size());
|
||||
return;
|
||||
}
|
||||
else if (dist > 100.0f) {
|
||||
} else if (route.GetStatus() == PathPartial) {
|
||||
c->Message(0, "Path from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) found with %i nodes, partial path.",
|
||||
src.x,
|
||||
src.y,
|
||||
@@ -4123,17 +4120,17 @@ void command_path(Client *c, const Seperator *sep)
|
||||
dest.y,
|
||||
dest.z,
|
||||
(int)nodes.size());
|
||||
return;
|
||||
}
|
||||
|
||||
c->Message(0, "Path from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) found with %i nodes, complete path.",
|
||||
src.x,
|
||||
src.y,
|
||||
src.z,
|
||||
dest.x,
|
||||
dest.y,
|
||||
dest.z,
|
||||
(int)nodes.size());
|
||||
else {
|
||||
c->Message(0, "Path from (%.2f, %.2f, %.2f) to (%.2f, %.2f, %.2f) found with %i nodes, broken path.",
|
||||
src.x,
|
||||
src.y,
|
||||
src.z,
|
||||
dest.x,
|
||||
dest.y,
|
||||
dest.z,
|
||||
(int)nodes.size());
|
||||
}
|
||||
}
|
||||
|
||||
void command_pvp(Client *c, const Seperator *sep)
|
||||
|
||||
+4
-27
@@ -38,35 +38,12 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
|
||||
|
||||
m_pathing_route = zone->pathing.FindRoute(from, to);
|
||||
|
||||
auto &nodes = m_pathing_route.GetNodesEdit();
|
||||
auto &last_node = nodes[nodes.size() - 1];
|
||||
//Code to complete partial paths.
|
||||
//If the path is too long then just warp to end.
|
||||
if (nodes.size() < 256) {
|
||||
auto dist = DistanceSquared(glm::vec4(last_node.position, 1.0f), glm::vec4(ToX, ToY, ToZ, 0.0f));
|
||||
if (dist > 10000.0f) {
|
||||
auto flag_temp = last_node.flag;
|
||||
last_node.flag = NavigationPolyFlagPortal;
|
||||
|
||||
PathfindingNode end;
|
||||
end.position.x = ToX;
|
||||
end.position.y = ToY;
|
||||
end.position.z = ToZ;
|
||||
end.flag = flag_temp;
|
||||
nodes.push_back(end);
|
||||
}
|
||||
else if (dist > 100.0f) {
|
||||
PathfindingNode end;
|
||||
end.position.x = ToX;
|
||||
end.position.y = ToY;
|
||||
end.position.z = ToZ;
|
||||
end.flag = NavigationPolyFlagNormal;
|
||||
nodes.push_back(end);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_pathing_route.GetStatus() == PathBroken) {
|
||||
auto &nodes = m_pathing_route.GetNodesEdit();
|
||||
auto &last_node = nodes[nodes.size() - 1];
|
||||
auto flag_temp = last_node.flag;
|
||||
last_node.flag = NavigationPolyFlagPortal;
|
||||
|
||||
PathfindingNode end;
|
||||
end.position.x = ToX;
|
||||
end.position.y = ToY;
|
||||
|
||||
Reference in New Issue
Block a user