return only the waypoints with changing directorn

master
Christopher Latza 2020-06-23 07:23:32 +02:00
parent 962d491def
commit 3af153a320
1 changed files with 14 additions and 9 deletions

View File

@ -443,22 +443,27 @@ namespace OpenSim.Modules.PathFinding
PathFinder pathFinder = new PathFinder(); PathFinder pathFinder = new PathFinder();
Path _pathFindingPath = pathFinder.FindPath(new GridPosition(_startNode.PositionX, _startNode.PositionY), new GridPosition(_targetNode.PositionX, _targetNode.PositionY), _pathFindingGrid); Path _pathFindingPath = pathFinder.FindPath(new GridPosition(_startNode.PositionX, _startNode.PositionY), new GridPosition(_targetNode.PositionX, _targetNode.PositionY), _pathFindingGrid);
if(_pathFindingPath.Type == PathType.Complete) String _pathString = "";
int lastX = 0;
int lastY = 0;
foreach (var _thisEdge in _pathFindingPath.Edges)
{ {
String _pathString = ""; if(lastX != (int)_thisEdge.End.Position.X && lastY != (int)_thisEdge.End.Position.Y)
{
foreach(var _thisEdge in _pathFindingPath.Edges)
_pathString += "<" + _thisEdge.End.Position.X + ", " + _thisEdge.End.Position.Y + ", 0>;"; _pathString += "<" + _thisEdge.End.Position.X + ", " + _thisEdge.End.Position.Y + ", 0>;";
lastX = (int)_thisEdge.End.Position.X;
lastY = (int)_thisEdge.End.Position.Y;
}
}
if (_pathFindingPath.Type == PathType.Complete)
{
m_scriptModule.DispatchReply(requestData.ScriptID, 19850, _pathString, requestData.RequestID.ToString()); m_scriptModule.DispatchReply(requestData.ScriptID, 19850, _pathString, requestData.RequestID.ToString());
} }
else else
{ {
String _pathString = "";
foreach (var _thisEdge in _pathFindingPath.Edges)
_pathString += "<" + _thisEdge.End.Position.X + ", " + _thisEdge.End.Position.Y + ", 0>;";
m_scriptModule.DispatchReply(requestData.ScriptID, 19855, _pathString, requestData.RequestID.ToString()); m_scriptModule.DispatchReply(requestData.ScriptID, 19855, _pathString, requestData.RequestID.ToString());
} }
} }