Fix some pathing logic that is using Z to match a node reach when it is error prone in certain scenarios

Fixed a decent amount of path logging
This commit is contained in:
Akkadius 2017-07-18 19:09:28 -05:00
parent a83edb83ba
commit 7cda4aaa2c
3 changed files with 72 additions and 70 deletions

View File

@ -87,6 +87,7 @@ enum LogCategory {
Client_Login, Client_Login,
Headless_Client, Headless_Client,
HP_Update, HP_Update,
FixZ,
MaxCategoryID /* Don't Remove this*/ MaxCategoryID /* Don't Remove this*/
}; };
@ -138,7 +139,8 @@ static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
"Login Server", "Login Server",
"Client Login", "Client Login",
"Headless Client", "Headless Client",
"HP Update" "HP Update",
"FixZ"
}; };
} }

View File

@ -206,7 +206,7 @@ glm::vec3 PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ)
std::deque<int> PathManager::FindRoute(int startID, int endID) std::deque<int> PathManager::FindRoute(int startID, int endID)
{ {
Log(Logs::Detail, Logs::None, "FindRoute from node %i to %i", startID, endID); Log(Logs::Detail, Logs::Pathing, "FindRoute from node %i to %i", startID, endID);
memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount); memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount);
@ -329,7 +329,7 @@ std::deque<int> PathManager::FindRoute(int startID, int endID)
} }
} }
Log(Logs::Detail, Logs::None, "Unable to find a route."); Log(Logs::Detail, Logs::Pathing, "Unable to find a route.");
return Route; return Route;
} }
@ -351,7 +351,7 @@ auto path_compare = [](const PathNodeSortStruct& a, const PathNodeSortStruct& b)
std::deque<int> PathManager::FindRoute(glm::vec3 Start, glm::vec3 End) std::deque<int> PathManager::FindRoute(glm::vec3 Start, glm::vec3 End)
{ {
Log(Logs::Detail, Logs::None, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); Log(Logs::Detail, Logs::Pathing, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z);
std::deque<int> noderoute; std::deque<int> noderoute;
@ -384,7 +384,7 @@ std::deque<int> PathManager::FindRoute(glm::vec3 Start, glm::vec3 End)
for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
{ {
Log(Logs::Detail, Logs::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); Log(Logs::Detail, Logs::Pathing, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id);
if(!zone->zonemap->LineIntersectsZone(Start, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) if(!zone->zonemap->LineIntersectsZone(Start, PathNodes[(*Iterator).id].v, 1.0f, nullptr))
{ {
@ -394,11 +394,11 @@ std::deque<int> PathManager::FindRoute(glm::vec3 Start, glm::vec3 End)
} }
if(ClosestPathNodeToStart <0 ) { if(ClosestPathNodeToStart <0 ) {
Log(Logs::Detail, Logs::None, "No LOS to any starting Path Node within range."); Log(Logs::Detail, Logs::Pathing, "No LOS to any starting Path Node within range.");
return noderoute; return noderoute;
} }
Log(Logs::Detail, Logs::None, "Closest Path Node To Start: %2d", ClosestPathNodeToStart); Log(Logs::Detail, Logs::Pathing, "Closest Path Node To Start: %2d", ClosestPathNodeToStart);
// Find the nearest PathNode the end point has LOS to // Find the nearest PathNode the end point has LOS to
@ -421,8 +421,8 @@ std::deque<int> PathManager::FindRoute(glm::vec3 Start, glm::vec3 End)
for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
{ {
Log(Logs::Detail, Logs::None, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id); Log(Logs::Detail, Logs::Pathing, "Checking Reachability of Node %i from End Position.", PathNodes[(*Iterator).id].id);
Log(Logs::Detail, Logs::None, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)", Log(Logs::Detail, Logs::Pathing, " (%8.3f, %8.3f, %8.3f) to (%8.3f, %8.3f, %8.3f)",
End.x, End.y, End.z, End.x, End.y, End.z,
PathNodes[(*Iterator).id].v.x, PathNodes[(*Iterator).id].v.y, PathNodes[(*Iterator).id].v.z); PathNodes[(*Iterator).id].v.x, PathNodes[(*Iterator).id].v.y, PathNodes[(*Iterator).id].v.z);
@ -434,11 +434,11 @@ std::deque<int> PathManager::FindRoute(glm::vec3 Start, glm::vec3 End)
} }
if(ClosestPathNodeToEnd < 0) { if(ClosestPathNodeToEnd < 0) {
Log(Logs::Detail, Logs::None, "No LOS to any end Path Node within range."); Log(Logs::Detail, Logs::Pathing, "No LOS to any end Path Node within range.");
return noderoute; return noderoute;
} }
Log(Logs::Detail, Logs::None, "Closest Path Node To End: %2d", ClosestPathNodeToEnd); Log(Logs::Detail, Logs::Pathing, "Closest Path Node To End: %2d", ClosestPathNodeToEnd);
if(ClosestPathNodeToStart == ClosestPathNodeToEnd) if(ClosestPathNodeToStart == ClosestPathNodeToEnd)
{ {
@ -673,7 +673,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if(To == From) if(To == From)
return To; return To;
Log(Logs::Detail, Logs::None, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z); Log(Logs::Detail, Logs::Pathing, "UpdatePath. From(%8.3f, %8.3f, %8.3f) To(%8.3f, %8.3f, %8.3f)", From.x, From.y, From.z, To.x, To.y, To.z);
if(From == PathingLastPosition) if(From == PathingLastPosition)
{ {
@ -681,7 +681,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if((PathingLoopCount > 5) && !IsRooted()) if((PathingLoopCount > 5) && !IsRooted())
{ {
Log(Logs::Detail, Logs::None, "appears to be stuck. Teleporting them to next position.", GetName()); Log(Logs::Detail, Logs::Pathing, "appears to be stuck. Teleporting them to next position.", GetName());
if(Route.empty()) if(Route.empty())
{ {
@ -721,7 +721,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
// If we are already pathing, and the destination is the same as before ... // If we are already pathing, and the destination is the same as before ...
if(SameDestination) if(SameDestination)
{ {
Log(Logs::Detail, Logs::None, " Still pathing to the same destination."); Log(Logs::Detail, Logs::Pathing, " Still pathing to the same destination.");
// Get the coordinates of the first path node we are going to. // Get the coordinates of the first path node we are going to.
NextNode = Route.front(); NextNode = Route.front();
@ -730,9 +730,9 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
// May need to refine this as rounding errors may mean we never have equality // May need to refine this as rounding errors may mean we never have equality
// We have reached the path node. // We have reached the path node.
if(NodeLoc == From) if(NodeLoc.x == From.x && NodeLoc.y == From.y)
{ {
Log(Logs::Detail, Logs::None, " Arrived at node %i", NextNode); Log(Logs::Detail, Logs::Pathing, " Arrived at node %i", NextNode);
NodeReached = true; NodeReached = true;
@ -746,17 +746,17 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
// target, and we may run past the target if we don't check LOS at this point. // target, and we may run past the target if we don't check LOS at this point.
int RouteSize = Route.size(); int RouteSize = Route.size();
Log(Logs::Detail, Logs::None, "Route size is %i", RouteSize); Log(Logs::Detail, Logs::Pathing, "Route size is %i", RouteSize);
if((RouteSize == 2) if((RouteSize == 2)
|| ((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck)) || ((PathingTraversedNodes >= RuleI(Pathing, MinNodesTraversedForLOSCheck))
&& (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck))
&& PathingLOSCheckTimer->Check())) && PathingLOSCheckTimer->Check()))
{ {
Log(Logs::Detail, Logs::None, " Checking distance to target."); Log(Logs::Detail, Logs::Pathing, " Checking distance to target.");
float Distance = VectorDistanceNoRoot(From, To); float Distance = VectorDistanceNoRoot(From, To);
Log(Logs::Detail, Logs::None, " Distance between From and To (NoRoot) is %8.3f", Distance); Log(Logs::Detail, Logs::Pathing, " Distance between From and To (NoRoot) is %8.3f", Distance);
if ((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && if ((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) &&
(std::abs(From.z - To.z) <= RuleR(Pathing, ZDiffThresholdNew))) { (std::abs(From.z - To.z) <= RuleR(Pathing, ZDiffThresholdNew))) {
@ -764,18 +764,18 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
PathingLOSState = HaveLOS; PathingLOSState = HaveLOS;
else else
PathingLOSState = NoLOS; PathingLOSState = NoLOS;
Log(Logs::Detail, Logs::None, "NoLOS"); Log(Logs::Detail, Logs::Pathing, "NoLOS");
if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To))
{ {
Log(Logs::Detail, Logs::None, " No hazards. Running directly to target."); Log(Logs::Detail, Logs::Pathing, " No hazards. Running directly to target.");
Route.clear(); Route.clear();
return To; return To;
} }
else else
{ {
Log(Logs::Detail, Logs::None, " Continuing on node path."); Log(Logs::Detail, Logs::Pathing, " Continuing on node path.");
} }
} }
else else
@ -801,7 +801,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if(Route.empty()) if(Route.empty())
{ {
Log(Logs::Detail, Logs::None, "Missing node after teleport."); Log(Logs::Detail, Logs::Pathing, "Missing node after teleport.");
return To; return To;
} }
@ -811,7 +811,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
Teleport(NodeLoc); Teleport(NodeLoc);
Log(Logs::Detail, Logs::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Log(Logs::Detail, Logs::Pathing, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z);
Route.pop_front(); Route.pop_front();
@ -822,7 +822,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
} }
zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this);
Log(Logs::Detail, Logs::None, " Now moving to node %i", NextNode); Log(Logs::Detail, Logs::Pathing, " Now moving to node %i", NextNode);
return zone->pathing->GetPathNodeCoordinates(NextNode); return zone->pathing->GetPathNodeCoordinates(NextNode);
} }
@ -830,7 +830,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
{ {
// we have run all the nodes, all that is left is the direct path from the last node // we have run all the nodes, all that is left is the direct path from the last node
// to the destination // to the destination
Log(Logs::Detail, Logs::None, " Reached end of node path, running direct to target."); Log(Logs::Detail, Logs::Pathing, " Reached end of node path, running direct to target.");
return To; return To;
} }
@ -844,11 +844,11 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
&& (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck)) && (RouteSize <= RuleI(Pathing, MinNodesLeftForLOSCheck))
&& PathingLOSCheckTimer->Check()) && PathingLOSCheckTimer->Check())
{ {
Log(Logs::Detail, Logs::None, " Checking distance to target."); Log(Logs::Detail, Logs::Pathing, " Checking distance to target.");
float Distance = VectorDistanceNoRoot(From, To); float Distance = VectorDistanceNoRoot(From, To);
Log(Logs::Detail, Logs::None, " Distance between From and To (NoRoot) is %8.3f", Distance); Log(Logs::Detail, Logs::Pathing, " Distance between From and To (NoRoot) is %8.3f", Distance);
if ((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && if ((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) &&
(std::abs(From.z - To.z) <= RuleR(Pathing, ZDiffThresholdNew))) { (std::abs(From.z - To.z) <= RuleR(Pathing, ZDiffThresholdNew))) {
@ -856,18 +856,18 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
PathingLOSState = HaveLOS; PathingLOSState = HaveLOS;
else else
PathingLOSState = NoLOS; PathingLOSState = NoLOS;
Log(Logs::Detail, Logs::None, "NoLOS"); Log(Logs::Detail, Logs::Pathing, "NoLOS");
if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To))
{ {
Log(Logs::Detail, Logs::None, " No hazards. Running directly to target."); Log(Logs::Detail, Logs::Pathing, " No hazards. Running directly to target.");
Route.clear(); Route.clear();
return To; return To;
} }
else else
{ {
Log(Logs::Detail, Logs::None, " Continuing on node path."); Log(Logs::Detail, Logs::Pathing, " Continuing on node path.");
} }
} }
else else
@ -879,7 +879,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
{ {
// We get here if we were already pathing, but our destination has now changed. // We get here if we were already pathing, but our destination has now changed.
// //
Log(Logs::Detail, Logs::None, " Target has changed position."); Log(Logs::Detail, Logs::Pathing, " Target has changed position.");
// Update our record of where we are going to. // Update our record of where we are going to.
PathingDestination = To; PathingDestination = To;
// Check if we now have LOS etc to the new destination. // Check if we now have LOS etc to the new destination.
@ -889,23 +889,23 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if ((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) && if ((Distance <= RuleR(Pathing, MinDistanceForLOSCheckShort)) &&
(std::abs(From.z - To.z) <= RuleR(Pathing, ZDiffThresholdNew))) { (std::abs(From.z - To.z) <= RuleR(Pathing, ZDiffThresholdNew))) {
Log(Logs::Detail, Logs::None, " Checking for short LOS at distance %8.3f.", Distance); Log(Logs::Detail, Logs::Pathing, " Checking for short LOS at distance %8.3f.", Distance);
if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr))
PathingLOSState = HaveLOS; PathingLOSState = HaveLOS;
else else
PathingLOSState = NoLOS; PathingLOSState = NoLOS;
Log(Logs::Detail, Logs::None, "NoLOS"); Log(Logs::Detail, Logs::Pathing, "NoLOS");
if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To))
{ {
Log(Logs::Detail, Logs::None, " No hazards. Running directly to target."); Log(Logs::Detail, Logs::Pathing, " No hazards. Running directly to target.");
Route.clear(); Route.clear();
return To; return To;
} }
else else
{ {
Log(Logs::Detail, Logs::None, " Continuing on node path."); Log(Logs::Detail, Logs::Pathing, " Continuing on node path.");
} }
} }
} }
@ -916,19 +916,19 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
{ {
if(!PathingRouteUpdateTimerShort->Check()) if(!PathingRouteUpdateTimerShort->Check())
{ {
Log(Logs::Detail, Logs::None, "Short route update timer not yet expired."); Log(Logs::Detail, Logs::Pathing, "Short route update timer not yet expired.");
return zone->pathing->GetPathNodeCoordinates(Route.front()); return zone->pathing->GetPathNodeCoordinates(Route.front());
} }
Log(Logs::Detail, Logs::None, "Short route update timer expired."); Log(Logs::Detail, Logs::Pathing, "Short route update timer expired.");
} }
else else
{ {
if(!PathingRouteUpdateTimerLong->Check()) if(!PathingRouteUpdateTimerLong->Check())
{ {
Log(Logs::Detail, Logs::None, "Long route update timer not yet expired."); Log(Logs::Detail, Logs::Pathing, "Long route update timer not yet expired.");
return zone->pathing->GetPathNodeCoordinates(Route.front()); return zone->pathing->GetPathNodeCoordinates(Route.front());
} }
Log(Logs::Detail, Logs::None, "Long route update timer expired."); Log(Logs::Detail, Logs::Pathing, "Long route update timer expired.");
} }
// We are already pathing, destination changed, no LOS. Find the nearest node to our destination. // We are already pathing, destination changed, no LOS. Find the nearest node to our destination.
@ -937,7 +937,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
// Destination unreachable via pathing, return direct route. // Destination unreachable via pathing, return direct route.
if(DestinationPathNode == -1) if(DestinationPathNode == -1)
{ {
Log(Logs::Detail, Logs::None, " Unable to find path node for new destination. Running straight to target."); Log(Logs::Detail, Logs::Pathing, " Unable to find path node for new destination. Running straight to target.");
Route.clear(); Route.clear();
return To; return To;
} }
@ -945,7 +945,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
// one, we will carry on on our path. // one, we will carry on on our path.
if(DestinationPathNode == Route.back()) if(DestinationPathNode == Route.back())
{ {
Log(Logs::Detail, Logs::None, " Same destination Node (%i). Continue with current path.", DestinationPathNode); Log(Logs::Detail, Logs::Pathing, " Same destination Node (%i). Continue with current path.", DestinationPathNode);
NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front());
@ -953,7 +953,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
// Check if we have reached a path node. // Check if we have reached a path node.
if(NodeLoc == From) if(NodeLoc == From)
{ {
Log(Logs::Detail, Logs::None, " Arrived at node %i, moving to next one.\n", Route.front()); Log(Logs::Detail, Logs::Pathing, " Arrived at node %i, moving to next one.\n", Route.front());
NodeReached = true; NodeReached = true;
@ -976,7 +976,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if(Route.empty()) if(Route.empty())
{ {
Log(Logs::Detail, Logs::None, "Missing node after teleport."); Log(Logs::Detail, Logs::Pathing, "Missing node after teleport.");
return To; return To;
} }
@ -986,7 +986,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
Teleport(NodeLoc); Teleport(NodeLoc);
Log(Logs::Detail, Logs::None, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); Log(Logs::Detail, Logs::Pathing, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z);
Route.pop_front(); Route.pop_front();
@ -996,7 +996,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
NextNode = Route.front(); NextNode = Route.front();
} }
// Return the coords of our next path node on the route. // Return the coords of our next path node on the route.
Log(Logs::Detail, Logs::None, " Now moving to node %i", NextNode); Log(Logs::Detail, Logs::Pathing, " Now moving to node %i", NextNode);
zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this); zone->pathing->OpenDoors(PathingLastNodeVisited, NextNode, this);
@ -1004,7 +1004,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
} }
else else
{ {
Log(Logs::Detail, Logs::None, " Reached end of path grid. Running direct to target."); Log(Logs::Detail, Logs::Pathing, " Reached end of path grid. Running direct to target.");
return To; return To;
} }
} }
@ -1012,7 +1012,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
} }
else else
{ {
Log(Logs::Detail, Logs::None, " Target moved. End node is different. Clearing route."); Log(Logs::Detail, Logs::Pathing, " Target moved. End node is different. Clearing route.");
Route.clear(); Route.clear();
// We will now fall through to get a new route. // We will now fall through to get a new route.
@ -1022,11 +1022,11 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
} }
Log(Logs::Detail, Logs::None, " Our route list is empty."); Log(Logs::Detail, Logs::Pathing, " Our route list is empty.");
if((SameDestination) && !PathingLOSCheckTimer->Check()) if((SameDestination) && !PathingLOSCheckTimer->Check())
{ {
Log(Logs::Detail, Logs::None, " Destination same as before, LOS check timer not reached. Returning To."); Log(Logs::Detail, Logs::Pathing, " Destination same as before, LOS check timer not reached. Returning To.");
return To; return To;
} }
@ -1040,22 +1040,22 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if ((Distance <= RuleR(Pathing, MinDistanceForLOSCheckLong)) && if ((Distance <= RuleR(Pathing, MinDistanceForLOSCheckLong)) &&
(std::abs(From.z - To.z) <= RuleR(Pathing, ZDiffThresholdNew))) { (std::abs(From.z - To.z) <= RuleR(Pathing, ZDiffThresholdNew))) {
Log(Logs::Detail, Logs::None, " Checking for long LOS at distance %8.3f.", Distance); Log(Logs::Detail, Logs::Pathing, " Checking for long LOS at distance %8.3f.", Distance);
if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr)) if(!zone->zonemap->LineIntersectsZone(HeadPosition, To, 1.0f, nullptr))
PathingLOSState = HaveLOS; PathingLOSState = HaveLOS;
else else
PathingLOSState = NoLOS; PathingLOSState = NoLOS;
Log(Logs::Detail, Logs::None, "NoLOS"); Log(Logs::Detail, Logs::Pathing, "NoLOS");
if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To)) if((PathingLOSState == HaveLOS) && zone->pathing->NoHazards(From, To))
{ {
Log(Logs::Detail, Logs::None, "Target is reachable. Running directly there."); Log(Logs::Detail, Logs::Pathing, "Target is reachable. Running directly there.");
return To; return To;
} }
} }
Log(Logs::Detail, Logs::None, " Calculating new route to target."); Log(Logs::Detail, Logs::Pathing, " Calculating new route to target.");
Route = zone->pathing->FindRoute(From, To); Route = zone->pathing->FindRoute(From, To);
@ -1063,14 +1063,14 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
if(Route.empty()) if(Route.empty())
{ {
Log(Logs::Detail, Logs::None, " No route available, running direct."); Log(Logs::Detail, Logs::Pathing, " No route available, running direct.");
return To; return To;
} }
if(SameDestination && (Route.front() == PathingLastNodeVisited)) if(SameDestination && (Route.front() == PathingLastNodeVisited))
{ {
Log(Logs::Detail, Logs::None, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited."); Log(Logs::Detail, Logs::Pathing, " Probable loop detected. Same destination and Route.front() == PathingLastNodeVisited.");
Route.clear(); Route.clear();
@ -1078,7 +1078,7 @@ glm::vec3 Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool &Wa
} }
NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front());
Log(Logs::Detail, Logs::None, " New route determined, heading for node %i", Route.front()); Log(Logs::Detail, Logs::Pathing, " New route determined, heading for node %i", Route.front());
PathingLoopCount = 0; PathingLoopCount = 0;
@ -1119,7 +1119,7 @@ int PathManager::FindNearestPathNode(glm::vec3 Position)
for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator) for(auto Iterator = SortedByDistance.begin(); Iterator != SortedByDistance.end(); ++Iterator)
{ {
Log(Logs::Detail, Logs::None, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id); Log(Logs::Detail, Logs::Pathing, "Checking Reachability of Node %i from Start Position.", PathNodes[(*Iterator).id].id);
if(!zone->zonemap->LineIntersectsZone(Position, PathNodes[(*Iterator).id].v, 1.0f, nullptr)) if(!zone->zonemap->LineIntersectsZone(Position, PathNodes[(*Iterator).id].v, 1.0f, nullptr))
{ {
@ -1129,7 +1129,7 @@ int PathManager::FindNearestPathNode(glm::vec3 Position)
} }
if(ClosestPathNodeToStart <0 ) { if(ClosestPathNodeToStart <0 ) {
Log(Logs::Detail, Logs::None, "No LOS to any starting Path Node within range."); Log(Logs::Detail, Logs::Pathing, "No LOS to any starting Path Node within range.");
return -1; return -1;
} }
return ClosestPathNodeToStart; return ClosestPathNodeToStart;
@ -1144,14 +1144,14 @@ bool PathManager::NoHazards(glm::vec3 From, glm::vec3 To)
float NewZ = zone->zonemap->FindBestZ(MidPoint, nullptr); float NewZ = zone->zonemap->FindBestZ(MidPoint, nullptr);
if (std::abs(NewZ - From.z) > RuleR(Pathing, ZDiffThresholdNew)) { if (std::abs(NewZ - From.z) > RuleR(Pathing, ZDiffThresholdNew)) {
Log(Logs::Detail, Logs::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", Log(Logs::Detail, Logs::Pathing, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f",
From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z);
return false; return false;
} }
else else
{ {
Log(Logs::Detail, Logs::None, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f", Log(Logs::Detail, Logs::Pathing, "No HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Z Change is %8.3f",
From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z); From.x, From.y, From.z, MidPoint.x, MidPoint.y, MidPoint.z, NewZ - From.z);
} }
@ -1182,7 +1182,7 @@ bool PathManager::NoHazardsAccurate(glm::vec3 From, glm::vec3 To)
glm::vec3 TestPoint(curx, cury, curz); glm::vec3 TestPoint(curx, cury, curz);
float NewZ = zone->zonemap->FindBestZ(TestPoint, nullptr); float NewZ = zone->zonemap->FindBestZ(TestPoint, nullptr);
if (std::abs(NewZ - last_z) > 5.0f) { if (std::abs(NewZ - last_z) > 5.0f) {
Log(Logs::Detail, Logs::None, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f", Log(Logs::Detail, Logs::Pathing, " HAZARD DETECTED moving from %8.3f, %8.3f, %8.3f to %8.3f, %8.3f, %8.3f. Best Z %8.3f, Z Change is %8.3f",
From.x, From.y, From.z, TestPoint.x, TestPoint.y, TestPoint.z, NewZ, NewZ - From.z); From.x, From.y, From.z, TestPoint.x, TestPoint.y, TestPoint.z, NewZ, NewZ - From.z);
return false; return false;
} }
@ -1210,20 +1210,20 @@ bool PathManager::NoHazardsAccurate(glm::vec3 From, glm::vec3 To)
} }
if (best_z2 == -999990) if (best_z2 == -999990)
{ {
Log(Logs::Detail, Logs::None, " HAZARD DETECTED, really deep water/lava!"); Log(Logs::Detail, Logs::Pathing, " HAZARD DETECTED, really deep water/lava!");
return false; return false;
} }
else else
{ {
if (std::abs(NewZ - best_z2) > RuleR(Pathing, ZDiffThresholdNew)) { if (std::abs(NewZ - best_z2) > RuleR(Pathing, ZDiffThresholdNew)) {
Log(Logs::Detail, Logs::None, Log(Logs::Detail, Logs::Pathing,
" HAZARD DETECTED, water is fairly deep at %8.3f units deep", " HAZARD DETECTED, water is fairly deep at %8.3f units deep",
std::abs(NewZ - best_z2)); std::abs(NewZ - best_z2));
return false; return false;
} }
else else
{ {
Log(Logs::Detail, Logs::None, Log(Logs::Detail, Logs::Pathing,
" HAZARD NOT DETECTED, water is shallow at %8.3f units deep", " HAZARD NOT DETECTED, water is shallow at %8.3f units deep",
std::abs(NewZ - best_z2)); std::abs(NewZ - best_z2));
} }
@ -1231,12 +1231,12 @@ bool PathManager::NoHazardsAccurate(glm::vec3 From, glm::vec3 To)
} }
else else
{ {
Log(Logs::Detail, Logs::None, "Hazard point not in water or lava!"); Log(Logs::Detail, Logs::Pathing, "Hazard point not in water or lava!");
} }
} }
else else
{ {
Log(Logs::Detail, Logs::None, "No water map loaded for hazards!"); Log(Logs::Detail, Logs::Pathing, "No water map loaded for hazards!");
} }
curx += stepx; curx += stepx;
@ -1291,7 +1291,7 @@ void PathManager::OpenDoors(int Node1, int Node2, Mob *ForWho)
if(d && !d->IsDoorOpen() ) if(d && !d->IsDoorOpen() )
{ {
Log(Logs::Detail, Logs::None, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName()); Log(Logs::Detail, Logs::Pathing, "Opening door %i for %s", PathNodes[Node1].Neighbours[i].DoorID, ForWho->GetName());
d->ForceOpen(ForWho); d->ForceOpen(ForWho);
} }

View File

@ -855,7 +855,7 @@ void Mob::FixZ() {
Log( Log(
Logs::Moderate, Logs::Moderate,
Logs::Pathing, Logs::FixZ,
"Mob::FixZ() (%s) returned %4.3f at %4.3f, %4.3f, %4.3f - Took %lf", "Mob::FixZ() (%s) returned %4.3f at %4.3f, %4.3f, %4.3f - Took %lf",
this->GetCleanName(), this->GetCleanName(),
new_z, new_z,
@ -875,7 +875,7 @@ void Mob::FixZ() {
if (RuleB(Map, MobZVisualDebug)) if (RuleB(Map, MobZVisualDebug))
this->SendAppearanceEffect(103, 0, 0, 0, 0); this->SendAppearanceEffect(103, 0, 0, 0, 0);
Log(Logs::General, Logs::Debug, "%s is failing to find Z %f", this->GetCleanName(), std::abs(m_Position.z - new_z)); Log(Logs::General, Logs::FixZ, "%s is failing to find Z %f", this->GetCleanName(), std::abs(m_Position.z - new_z));
} }
last_z = m_Position.z; last_z = m_Position.z;