Core/AI: fix _returnToStart handling in ScriptedEscortAI

(cherry picked from commit 84b0222bdcce8e6a0fe0589e334d1ff476ccfb2d)
This commit is contained in:
ccrs
2026-06-30 19:16:20 +02:00
committed by Shauren
parent 8a80fa58c8
commit 855a11caed
@@ -174,19 +174,20 @@ void EscortAI::UpdateAI(uint32 diff)
if (_despawnAtEnd)
{
TC_LOG_DEBUG("scripts.ai.escortai", "EscortAI::UpdateAI: reached end of waypoints, despawning at end ({})", me->GetGUID().ToString());
if (_returnToStart)
{
Position respawnPosition = me->GetRespawnPosition();
me->GetMotionMaster()->MovePoint(POINT_HOME, respawnPosition);
TC_LOG_DEBUG("scripts.ai.escortai", "EscortAI::UpdateAI: returning to spawn location: {} ({})", respawnPosition, me->GetGUID().ToString());
}
else if (_instantRespawn)
if (_instantRespawn)
me->Respawn(true);
else
me->DespawnOrUnsummon();
}
else if (_returnToStart)
{
Position respawnPosition = me->GetRespawnPosition();
me->GetMotionMaster()->MovePoint(POINT_HOME, respawnPosition);
TC_LOG_DEBUG("scripts.ai.escortai", "EscortAI::UpdateAI: returning to spawn location: {} ({})", respawnPosition, me->GetGUID().ToString());
}
else
RemoveEscortState(STATE_ESCORT_ESCORTING);
TC_LOG_DEBUG("scripts.ai.escortai", "EscortAI::UpdateAI: reached end of waypoints ({})", me->GetGUID().ToString());
RemoveEscortState(STATE_ESCORT_ESCORTING);
return;
}