mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 17:49:10 +00:00
fix(Core/Movement): Rewritten follow movement generator for pets (#7324)
- Closes #7296
This commit is contained in:
@@ -2539,7 +2539,7 @@ namespace Acore
|
||||
|
||||
//===================================================================================================
|
||||
|
||||
void WorldObject::GetNearPoint2D(WorldObject const* searcher, float& x, float& y, float distance2d, float absAngle) const
|
||||
void WorldObject::GetNearPoint2D(WorldObject const* searcher, float& x, float& y, float distance2d, float absAngle, Position const* startPos) const
|
||||
{
|
||||
float effectiveReach = GetCombatReach();
|
||||
|
||||
@@ -2561,24 +2561,28 @@ void WorldObject::GetNearPoint2D(WorldObject const* searcher, float& x, float& y
|
||||
}
|
||||
}
|
||||
|
||||
x = GetPositionX() + (effectiveReach + distance2d) * std::cos(absAngle);
|
||||
y = GetPositionY() + (effectiveReach + distance2d) * std::sin(absAngle);
|
||||
float positionX = startPos ? startPos->GetPositionX() : GetPositionX();
|
||||
float positionY = startPos ? startPos->GetPositionY() : GetPositionY();
|
||||
|
||||
x = positionX + (effectiveReach + distance2d) * std::cos(absAngle);
|
||||
y = positionY + (effectiveReach + distance2d) * std::sin(absAngle);
|
||||
|
||||
Acore::NormalizeMapCoord(x);
|
||||
Acore::NormalizeMapCoord(y);
|
||||
}
|
||||
|
||||
void WorldObject::GetNearPoint2D(float& x, float& y, float distance2d, float absAngle) const
|
||||
void WorldObject::GetNearPoint2D(float& x, float& y, float distance2d, float absAngle, Position const* startPos) const
|
||||
{
|
||||
GetNearPoint2D(nullptr, x, y, distance2d, absAngle);
|
||||
GetNearPoint2D(nullptr, x, y, distance2d, absAngle, startPos);
|
||||
}
|
||||
|
||||
void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y, float& z, float searcher_size, float distance2d, float absAngle, float controlZ) const
|
||||
void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y, float& z, float searcher_size, float distance2d, float absAngle, float controlZ, Position const* startPos) const
|
||||
{
|
||||
GetNearPoint2D(x, y, distance2d + searcher_size, absAngle);
|
||||
GetNearPoint2D(x, y, distance2d + searcher_size, absAngle, startPos);
|
||||
z = GetPositionZ();
|
||||
|
||||
if (searcher) {
|
||||
if (searcher)
|
||||
{
|
||||
if (Unit const* unit = searcher->ToUnit(); Unit const* target = ToUnit())
|
||||
{
|
||||
if (unit && target && unit->IsInWater() && target->IsInWater())
|
||||
@@ -2614,7 +2618,7 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||
// loop in a circle to look for a point in LoS using small steps
|
||||
for (float angle = float(M_PI) / 8; angle < float(M_PI) * 2; angle += float(M_PI) / 8)
|
||||
{
|
||||
GetNearPoint2D(x, y, distance2d + searcher_size, absAngle + angle);
|
||||
GetNearPoint2D(x, y, distance2d + searcher_size, absAngle + angle, startPos);
|
||||
z = GetPositionZ();
|
||||
UpdateAllowedPositionZ(x, y, z);
|
||||
if (controlZ && fabsf(GetPositionZ() - z) > controlZ)
|
||||
|
||||
Reference in New Issue
Block a user