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())
+2 -2
View File
@@ -359,7 +359,7 @@ namespace Game.Movement
float dist = 2 * moveTimeHalf * speedXY;
float max_height = -MoveSpline.ComputeFallElevation(moveTimeHalf, false, -speedZ);
_owner.GetNearPoint(_owner, out x, out y, out z, _owner.GetCombatReach(), dist, _owner.GetAbsoluteAngle(srcX, srcY) + MathFunctions.PI);
_owner.GetNearPoint(_owner, out x, out y, out z, dist, _owner.GetAbsoluteAngle(srcX, srcY) + MathFunctions.PI);
MoveSplineInit init = new(_owner);
init.MoveTo(x, y, z);
@@ -381,7 +381,7 @@ namespace Game.Movement
float moveTimeHalf = (float)(speedZ / gravity);
float dist = 2 * moveTimeHalf * speedXY;
_owner.GetNearPoint2D(out float x, out float y, dist, _owner.GetOrientation() + angle);
_owner.GetNearPoint2D(null, out float x, out float y, dist, _owner.GetOrientation() + angle);
float z = _owner.GetPositionZ();
_owner.UpdateAllowedPositionZ(x, y, ref z);
MoveJump(x, y, z, 0.0f, speedXY, speedZ);