mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-15 09:50:27 +00:00
better movement
This commit is contained in:
@@ -34,22 +34,22 @@ WorldLocation MoveAheadFormation::GetLocation()
|
||||
float y = loc.GetPositionY();
|
||||
float z = loc.GetPositionZ();
|
||||
|
||||
if (master->isMoving())
|
||||
{
|
||||
float ori = master->GetOrientation();
|
||||
float x1 = x + sPlayerbotAIConfig->tooCloseDistance * cos(ori);
|
||||
float y1 = y + sPlayerbotAIConfig->tooCloseDistance * sin(ori);
|
||||
float ground = master->GetMap()->GetHeight(x1, y1, z);
|
||||
if (ground > INVALID_HEIGHT)
|
||||
{
|
||||
x = x1;
|
||||
y = y1;
|
||||
}
|
||||
}
|
||||
// if (master->isMoving())
|
||||
// {
|
||||
// float ori = master->GetOrientation();
|
||||
// float x1 = x + sPlayerbotAIConfig->tooCloseDistance * cos(ori);
|
||||
// float y1 = y + sPlayerbotAIConfig->tooCloseDistance * sin(ori);
|
||||
// float ground = master->GetMap()->GetHeight(x1, y1, z);
|
||||
// if (ground > INVALID_HEIGHT)
|
||||
// {
|
||||
// x = x1;
|
||||
// y = y1;
|
||||
// }
|
||||
// }
|
||||
|
||||
float ground = master->GetMap()->GetHeight(x, y, z);
|
||||
if (ground <= INVALID_HEIGHT)
|
||||
return Formation::NullLocation;
|
||||
// float ground = master->GetMap()->GetHeight(x, y, z);
|
||||
// if (ground <= INVALID_HEIGHT)
|
||||
// return Formation::NullLocation;
|
||||
|
||||
//z += CONTACT_DISTANCE;
|
||||
//bot->UpdateAllowedPositionZ(x, y, z);
|
||||
@@ -88,7 +88,7 @@ class NearFormation : public MoveAheadFormation
|
||||
float x = master->GetPositionX() + cos(angle) * range;
|
||||
float y = master->GetPositionY() + sin(angle) * range;
|
||||
float z = master->GetPositionZ();
|
||||
float ground = master->GetMap()->GetHeight(x, y, z);
|
||||
float ground = master->GetMap()->GetHeight(x, y, z + 30.0f);
|
||||
if (ground <= INVALID_HEIGHT)
|
||||
return Formation::NullLocation;
|
||||
|
||||
@@ -126,7 +126,7 @@ class ChaosFormation : public MoveAheadFormation
|
||||
float x = master->GetPositionX() + cos(angle) * range + dx;
|
||||
float y = master->GetPositionY() + sin(angle) * range + dy;
|
||||
float z = master->GetPositionZ();
|
||||
float ground = master->GetMap()->GetHeight(x, y, z);
|
||||
float ground = master->GetMap()->GetHeight(x, y, z + 30.0f);
|
||||
if (ground <= INVALID_HEIGHT)
|
||||
return Formation::NullLocation;
|
||||
|
||||
@@ -183,7 +183,7 @@ class CircleFormation : public MoveFormation
|
||||
float x = target->GetPositionX() + cos(angle) * range;
|
||||
float y = target->GetPositionY() + sin(angle) * range;
|
||||
float z = target->GetPositionZ();
|
||||
float ground = target->GetMap()->GetHeight(x, y, z);
|
||||
float ground = target->GetMap()->GetHeight(x, y, z + 30.0f);
|
||||
if (ground <= INVALID_HEIGHT)
|
||||
return Formation::NullLocation;
|
||||
|
||||
@@ -327,7 +327,7 @@ class FarFormation : public FollowFormation
|
||||
float y = master->GetPositionY() + sin(angle) * range + sin(followAngle) * followRange;
|
||||
float z = master->GetPositionZ();
|
||||
|
||||
float ground = master->GetMap()->GetHeight(x, y, z);
|
||||
float ground = master->GetMap()->GetHeight(x, y, z + 30.0f);
|
||||
if (ground <= INVALID_HEIGHT)
|
||||
{
|
||||
float minDist = 0, minX = 0, minY = 0;
|
||||
@@ -336,7 +336,7 @@ class FarFormation : public FollowFormation
|
||||
x = master->GetPositionX() + cos(angle) * range + cos(followAngle) * followRange;
|
||||
y = master->GetPositionY() + sin(angle) * range + sin(followAngle) * followRange;
|
||||
float dist = sServerFacade->GetDistance2d(bot, x, y);
|
||||
float ground = master->GetMap()->GetHeight(x, y, z);
|
||||
float ground = master->GetMap()->GetHeight(x, y, z + 30.0f);
|
||||
if (ground > INVALID_HEIGHT && (!minDist || minDist > dist))
|
||||
{
|
||||
minDist = dist;
|
||||
@@ -613,7 +613,7 @@ WorldLocation MoveFormation::MoveSingleLine(std::vector<Player*> line, float dif
|
||||
float lx = x + cos(angle) * radius;
|
||||
float ly = y + sin(angle) * radius;
|
||||
float lz = cz;
|
||||
float ground = bot->GetMap()->GetHeight(lx, ly, lz);
|
||||
float ground = bot->GetMap()->GetHeight(lx, ly, lz + 30.0f);
|
||||
if (ground <= INVALID_HEIGHT)
|
||||
return Formation::NullLocation;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user