FIx move to

This commit is contained in:
Yunfan Li
2024-02-09 21:35:19 +08:00
parent 5e39f3c732
commit a7e33a6fad

View File

@@ -149,7 +149,13 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
// if (bot->Unit::IsFalling()) {
// bot->Say("I'm falling", LANG_UNIVERSAL);
// }
float distance = bot->GetExactDist(x, y, z);
bool generatePath = !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) &&
!bot->IsFlying() && !bot->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) && !bot->IsInWater();
float modifiedZ = SearchBestGroundZForPath(x, y, z, generatePath, 20.0f, normal_only);
if (modifiedZ == INVALID_HEIGHT) {
return false;
}
float distance = bot->GetExactDist(x, y, modifiedZ);
if (distance > sPlayerbotAIConfig->contactDistance)
{
WaitForReach(distance);
@@ -162,14 +168,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
bot->CastStop();
botAI->InterruptSpell();
}
bool generatePath = !bot->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) &&
!bot->IsFlying() && !bot->HasUnitMovementFlag(MOVEMENTFLAG_SWIMMING) && !bot->IsInWater();
MotionMaster &mm = *bot->GetMotionMaster();
float modifiedZ = SearchBestGroundZForPath(x, y, z, generatePath, 20.0f, normal_only);
if (modifiedZ == INVALID_HEIGHT) {
return false;
}
mm.Clear();
mm.MovePoint(mapId, x, y, modifiedZ, generatePath);
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation());