Core/Object: Bump hover delta handling on nearpoints downstack into GetNearPoint2D (from movement generators); functionality should be unchanged

Port From (https://github.com/TrinityCore/TrinityCore/commit/f69d12504ca3089439fa6d33b7c6e73e1585779f)
This commit is contained in:
hondacrx
2021-09-24 10:05:14 -04:00
parent 3e663b9ac1
commit 3356b921ab
3 changed files with 37 additions and 22 deletions
@@ -141,35 +141,25 @@ namespace Game.Movement
float x, y, z;
if (updateDestination || _path == null)
{
float size = owner.GetCombatReach();
float hoverDiff = Math.Abs(owner.GetHoverOffset() - GetTarget().GetHoverOffset());
if (_offset == 0)
{
if (GetTarget().IsWithinDistInMap(owner, SharedConst.ContactDistance))
return;
// to nearest contact position
if (hoverDiff != 0f)
size = size > hoverDiff ? MathF.Sqrt(size * size - hoverDiff * hoverDiff) : 0.0f;
GetTarget().GetNearPoint(owner, out x, out y, out z, size, SharedConst.ContactDistance, GetTarget().GetAbsoluteAngle(owner));
GetTarget().GetNearPoint(owner, out x, out y, out z, SharedConst.ContactDistance, GetTarget().GetAbsoluteAngle(owner));
}
else
{
float distance = _offset + 1.0f;
if (owner.IsPet() && GetTarget().GetTypeId() == TypeId.Player)
{
distance = 1.0f;
size = 1.0f;
}
else if (hoverDiff != 0)
size = size > hoverDiff ? MathF.Sqrt(size * size - hoverDiff * hoverDiff) : 0.0f;
if (GetTarget().IsWithinDistInMap(owner, distance))
return;
GetTarget().GetClosePoint(out x, out y, out z, size, _offset, _angle);
GetTarget().GetClosePoint(out x, out y, out z, _offset, _angle);
}
if (owner.IsHovering())