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