Core/Object: Added max height change param to MovePosition

Port From (https://github.com/TrinityCore/TrinityCore/commit/35b8868763cc46a16511b11a5c735dc534e887dc)
This commit is contained in:
Hondacrx
2024-11-10 14:07:35 -05:00
parent 6809033fcb
commit a782ecb5b3
+2 -2
View File
@@ -3658,7 +3658,7 @@ namespace Game.Entities
GetNearPoint(obj, out x, out y, out z, distance2d, GetAbsoluteAngle(obj));
}
public void MovePosition(Position pos, float dist, float angle)
public void MovePosition(Position pos, float dist, float angle, float maxHeightChange = 6.0f)
{
angle += GetOrientation();
float destx = pos.posX + dist * (float)Math.Cos(angle);
@@ -3680,7 +3680,7 @@ namespace Game.Entities
for (byte j = 0; j < 10; ++j)
{
// do not allow too big z changes
if (Math.Abs(pos.posZ - destz) > 6)
if (Math.Abs(pos.posZ - destz) > maxHeightChange)
{
destx -= step * (float)Math.Cos(angle);
desty -= step * (float)Math.Sin(angle);