fix(Core/SmartAI): Prevent MOVE_TO_POS from creating large distances between target (#15899)

Update SmartScript.cpp
This commit is contained in:
Gultask
2023-04-09 23:44:52 -03:00
committed by GitHub
parent 9c6a561404
commit fd6941de7c

View File

@@ -1635,7 +1635,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
float x, y, z;
target->GetPosition(x, y, z);
if (e.action.moveToPos.ContactDistance > 0)
target->GetContactPoint(me, x, y, z, e.action.moveToPos.ContactDistance);
{
target->GetNearPoint(me, x, y, z, e.action.moveToPos.ContactDistance, 0, target->GetAngle(me));
}
me->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, x + e.target.x, y + e.target.y, z + e.target.z, true, true, isControlled ? MOTION_SLOT_CONTROLLED : MOTION_SLOT_ACTIVE);
}
break;