fix: Fixes FastAStar (#788)
* Fixes FastAStar algorithm, thanks @nullptr-w8 * Cleans up the code a little * Removes SlowAStar * Changes [Path recall runes to waypoints
This commit is contained in:
parent
73c65a43ad
commit
fd440f29ce
4 changed files with 77 additions and 392 deletions
|
|
@ -3,7 +3,6 @@ using System.Diagnostics;
|
|||
using Server.Items;
|
||||
using Server.PathAlgorithms;
|
||||
using Server.PathAlgorithms.FastAStar;
|
||||
using Server.PathAlgorithms.SlowAStar;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
|
|
@ -89,18 +88,21 @@ namespace Server
|
|||
var y = from.Y;
|
||||
var z = from.Z;
|
||||
|
||||
WayPoint waypoint = null;
|
||||
|
||||
for (var i = 0; i < path.Directions.Length; ++i)
|
||||
{
|
||||
Movement.Movement.Offset(path.Directions[i], ref x, ref y);
|
||||
|
||||
new RecallRune().MoveToWorld(new Point3D(x, y, z + zOffset), from.Map);
|
||||
waypoint = new WayPoint(waypoint);
|
||||
waypoint.MoveToWorld(new Point3D(x, y, z + zOffset), from.Map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Path_OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (!(targeted is IPoint3D p))
|
||||
if (targeted is not IPoint3D p)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -108,7 +110,6 @@ namespace Server
|
|||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
Path(from, p, FastAStarAlgorithm.Instance, "Fast", 0);
|
||||
Path(from, p, SlowAStarAlgorithm.Instance, "Slow", 2);
|
||||
OverrideAlgorithm = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue