Core/Movement: Smooth movement
This commit is contained in:
@@ -2228,58 +2228,6 @@ namespace Game.AI
|
||||
Global.GameEventMgr.StartEvent(eventId, true);
|
||||
break;
|
||||
}
|
||||
case SmartActions.StartClosestWaypoint:
|
||||
{
|
||||
uint[] waypoints = new uint[SharedConst.SmartActionParamCount];
|
||||
waypoints[0] = e.Action.closestWaypointFromList.wp1;
|
||||
waypoints[1] = e.Action.closestWaypointFromList.wp2;
|
||||
waypoints[2] = e.Action.closestWaypointFromList.wp3;
|
||||
waypoints[3] = e.Action.closestWaypointFromList.wp4;
|
||||
waypoints[4] = e.Action.closestWaypointFromList.wp5;
|
||||
waypoints[5] = e.Action.closestWaypointFromList.wp6;
|
||||
float distanceToClosest = float.MaxValue;
|
||||
SmartPath closestWp = null;
|
||||
|
||||
var targets = GetTargets(e, unit);
|
||||
|
||||
foreach (var obj in targets)
|
||||
{
|
||||
Creature target = obj.ToCreature();
|
||||
if (target)
|
||||
{
|
||||
if (IsSmart(target))
|
||||
{
|
||||
for (byte i = 0; i < SharedConst.SmartActionParamCount; i++)
|
||||
{
|
||||
if (waypoints[i] == 0)
|
||||
continue;
|
||||
|
||||
var path = Global.SmartAIMgr.GetPath(waypoints[i]);
|
||||
|
||||
if (path.Empty())
|
||||
continue;
|
||||
|
||||
SmartPath wp = path[0];
|
||||
if (wp != null)
|
||||
{
|
||||
float distToThisPath = target.GetDistance(wp.x, wp.y, wp.z);
|
||||
|
||||
if (distToThisPath < distanceToClosest)
|
||||
{
|
||||
distanceToClosest = distToThisPath;
|
||||
closestWp = wp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (closestWp != null)
|
||||
((SmartAI)target.GetAI()).StartPath(false, closestWp.id, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SmartActions.RandomSound:
|
||||
{
|
||||
uint[] sounds = new uint[SharedConst.SmartActionParamCount - 1];
|
||||
|
||||
Reference in New Issue
Block a user