From 395cf2e8ce5c04682a1386cbc74fa89ed82e0579 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 3 Sep 2018 03:46:48 -0500 Subject: [PATCH] Roambox logic now uses navmesh --- zone/mob_ai.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 2ba5cea7f..854a9a339 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1741,7 +1741,20 @@ void NPC::AI_DoMovement() { this->FixZ(); } - if (!CalculateNewPosition(roambox_destination_x, roambox_destination_y, m_Position.z, move_speed, true)) { + bool waypoint_changed, node_reached; + + glm::vec3 Goal = UpdatePath( + roambox_destination_x, + roambox_destination_y, + GetGroundZ(roambox_destination_x, roambox_destination_y), + move_speed, + waypoint_changed, + node_reached + ); + + CalculateNewPosition(Goal.x, Goal.y, Goal.z, move_speed, true); + + if (m_Position.x == roambox_destination_x && m_Position.y == roambox_destination_y) { time_until_can_move = Timer::GetCurrentTime() + RandomTimer(roambox_min_delay, roambox_delay); SetMoving(false); this->FixZ();