Fear pathing fixups, random path rewrite, and nektulos / general roambox fixups where best Z axis is below the ground

This commit is contained in:
E Spause
2018-10-19 22:35:38 -04:00
parent 904bc3e004
commit e466f9b3f9
9 changed files with 44 additions and 42 deletions
+5 -3
View File
@@ -802,6 +802,7 @@ void Client::AI_Process()
if (AI_movement_timer->Check()) {
// Check if we have reached the last fear point
if(IsPositionEqualWithinCertainZ(glm::vec3(GetX(), GetY(), GetZ()), m_FearWalkTarget, 5.0f)) {
StopNavigation();
CalculateNewFearpoint();
}
@@ -1080,11 +1081,12 @@ void Mob::AI_Process() {
else {
if (AI_movement_timer->Check()) {
// Check if we have reached the last fear point
if (IsPositionEqualWithinCertainZ(glm::vec3(GetX(), GetY(), GetZ()), m_FearWalkTarget, 5.0f)) {
if (DistanceNoZ(glm::vec3(GetX(), GetY(), GetZ()), m_FearWalkTarget) <= 5.0f) {
// Calculate a new point to run to
StopNavigation();
CalculateNewFearpoint();
}
NavigateTo(
RunTo(
m_FearWalkTarget.x,
m_FearWalkTarget.y,
m_FearWalkTarget.z
@@ -1661,7 +1663,7 @@ void NPC::AI_DoMovement() {
destination.x = roambox_destination_x;
destination.y = roambox_destination_y;
destination.z = m_Position.z;
roambox_destination_z = GetFixedZ(destination) + this->GetZOffset();
roambox_destination_z = zone->zonemap->FindClosestZ(glm::vec3(roambox_destination_x, roambox_destination_y, roambox_destination_z), nullptr) + this->GetZOffset();
Log(Logs::Detail,
Logs::NPCRoamBox,