mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
FIx move to
This commit is contained in:
@@ -149,7 +149,13 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
// if (bot->Unit::IsFalling()) {
|
// if (bot->Unit::IsFalling()) {
|
||||||
// bot->Say("I'm falling", LANG_UNIVERSAL);
|
// 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)
|
if (distance > sPlayerbotAIConfig->contactDistance)
|
||||||
{
|
{
|
||||||
WaitForReach(distance);
|
WaitForReach(distance);
|
||||||
@@ -162,14 +168,8 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
|||||||
bot->CastStop();
|
bot->CastStop();
|
||||||
botAI->InterruptSpell();
|
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();
|
MotionMaster &mm = *bot->GetMotionMaster();
|
||||||
|
|
||||||
float modifiedZ = SearchBestGroundZForPath(x, y, z, generatePath, 20.0f, normal_only);
|
|
||||||
if (modifiedZ == INVALID_HEIGHT) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
mm.Clear();
|
mm.Clear();
|
||||||
mm.MovePoint(mapId, x, y, modifiedZ, generatePath);
|
mm.MovePoint(mapId, x, y, modifiedZ, generatePath);
|
||||||
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation());
|
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation());
|
||||||
|
|||||||
Reference in New Issue
Block a user