mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Waypoint for move random
This commit is contained in:
@@ -2325,12 +2325,15 @@ bool MoveRandomAction::Execute(Event event)
|
|||||||
float angle = (float)rand_norm() * static_cast<float>(M_PI);
|
float angle = (float)rand_norm() * static_cast<float>(M_PI);
|
||||||
x += urand(0, distance) * cos(angle);
|
x += urand(0, distance) * cos(angle);
|
||||||
y += urand(0, distance) * sin(angle);
|
y += urand(0, distance) * sin(angle);
|
||||||
bot->UpdateGroundPositionZ(x, y, z);
|
if (!bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(),
|
||||||
|
bot->GetPositionZ(), x, y, z))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (map->IsInWater(bot->GetPhaseMask(), x, y, z, bot->GetCollisionHeight()))
|
if (map->IsInWater(bot->GetPhaseMask(), x, y, z, bot->GetCollisionHeight()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool moved = MoveTo(bot->GetMapId(), x, y, z);
|
bool moved = MoveTo(bot->GetMapId(), x, y, z, false, false, false, true);
|
||||||
if (moved)
|
if (moved)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user