remove all targets then a new one will set
parent
c0028e3ba9
commit
db977ad30f
|
@ -130,10 +130,10 @@ namespace OpenSim.Modules.PathFinding
|
|||
|
||||
#region Asyn Funktions
|
||||
|
||||
private void generatePathEnvironment(ScriptRequestData requestData, int size)
|
||||
private void generatePathEnvironment(ScriptRequestData requestData)
|
||||
{
|
||||
UUID _envID = UUID.Random();
|
||||
Environment _newEnv = new Environment(_envID.ToString(), size);
|
||||
Environment _newEnv = new Environment(_envID.ToString(), (int)m_scene.RegionInfo.RegionSizeX);
|
||||
|
||||
lock(m_environments)
|
||||
{
|
||||
|
@ -157,12 +157,30 @@ namespace OpenSim.Modules.PathFinding
|
|||
m_scriptModule.DispatchReply(requestData.ScriptID, 19851, "", requestData.RequestID.ToString());
|
||||
}
|
||||
|
||||
private void removeAllTargets(ScriptRequestData requestData)
|
||||
{
|
||||
Environment _env = m_environments.Find(X => X.ID == requestData.EnvironmentID);
|
||||
|
||||
if (_env != null)
|
||||
{
|
||||
List<PathNode> _nodes = _env.Nodes.FindAll(X => X.Target == true);
|
||||
|
||||
foreach(PathNode thisNode in _nodes)
|
||||
{
|
||||
thisNode.Target = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setPositionData(ScriptRequestData requestData, Vector3 position, int walkable, int isTarget)
|
||||
{
|
||||
Environment _env = m_environments.Find(X => X.ID == requestData.EnvironmentID);
|
||||
|
||||
if (_env != null)
|
||||
{
|
||||
if (isTarget == 1)
|
||||
removeAllTargets(requestData);
|
||||
|
||||
PathNode _node = _env.Nodes.Find(X => X.PositionX == (int)position.X && X.PositionY == (int)position.Y);
|
||||
|
||||
if (_node == null)
|
||||
|
@ -183,7 +201,6 @@ namespace OpenSim.Modules.PathFinding
|
|||
if (isTarget == 0)
|
||||
_node.Target = false;
|
||||
|
||||
m_scriptModule.DispatchReply(requestData.ScriptID, 19850, "", requestData.RequestID.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue