add answer to script
parent
fea47de571
commit
413dd571ee
|
@ -135,38 +135,48 @@ namespace OpenSim.Modules.PathFinding
|
|||
|
||||
#region Script Funktions
|
||||
|
||||
private void createPathFindingScene(String imageName)
|
||||
private void createPathFindingScene(UUID script, String imageName, Vector3 start, Vector3 target)
|
||||
{
|
||||
Bitmap _map = new Bitmap((int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY);
|
||||
|
||||
for (int X = 0; X < m_scene.RegionInfo.RegionSizeX; X++)
|
||||
try
|
||||
{
|
||||
for (int Y = 0; Y < m_scene.RegionInfo.RegionSizeY; Y++)
|
||||
Bitmap _map = new Bitmap((int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY);
|
||||
|
||||
for (int X = 0; X < m_scene.RegionInfo.RegionSizeX; X++)
|
||||
{
|
||||
int _imageX = ((int)m_scene.RegionInfo.RegionSizeX - 1) - X;
|
||||
int _imageY = ((int)m_scene.RegionInfo.RegionSizeY - 1) - Y;
|
||||
for (int Y = 0; Y < m_scene.RegionInfo.RegionSizeY; Y++)
|
||||
{
|
||||
int _imageX = ((int)m_scene.RegionInfo.RegionSizeX - 1) - X;
|
||||
int _imageY = ((int)m_scene.RegionInfo.RegionSizeY - 1) - Y;
|
||||
|
||||
float baseheight = (float)m_scene.Heightmap[X, Y];
|
||||
float baseheight = (float)m_scene.Heightmap[X, Y];
|
||||
|
||||
if (baseheight <= m_scene.RegionInfo.RegionSettings.WaterHeight)
|
||||
_map.SetPixel(_imageX, _imageY, Color.Blue);
|
||||
if (baseheight <= m_scene.RegionInfo.RegionSettings.WaterHeight)
|
||||
_map.SetPixel(_imageX, _imageY, Color.Blue);
|
||||
|
||||
if (baseheight > m_scene.RegionInfo.RegionSettings.WaterHeight)
|
||||
_map.SetPixel(_imageX, _imageY, Color.Green);
|
||||
if (baseheight > m_scene.RegionInfo.RegionSettings.WaterHeight)
|
||||
_map.SetPixel(_imageX, _imageY, Color.Green);
|
||||
}
|
||||
}
|
||||
|
||||
_map.SetPixel((int)start.X, (int)start.Y, Color.Aqua);
|
||||
|
||||
PathFindingSceneGenerator.DrawObjectVolume(m_scene, ref _map);
|
||||
_map.Save(imageName + ".png", ImageFormat.Png);
|
||||
|
||||
m_scriptModule.DispatchReply(script, 0, "done", imageName);
|
||||
}
|
||||
catch(Exception _error)
|
||||
{
|
||||
m_log.Error(_error.Message);
|
||||
m_scriptModule.DispatchReply(script, 0, "failed", imageName);
|
||||
}
|
||||
|
||||
_map.SetPixel(0, 0, Color.White);
|
||||
|
||||
PathFindingSceneGenerator.DrawObjectVolume(m_scene, ref _map);
|
||||
_map.Save(imageName + ".png", ImageFormat.Png);
|
||||
|
||||
}
|
||||
|
||||
[ScriptInvocation]
|
||||
public string osCreateNewPathFindingScene(UUID hostID, UUID scriptID)
|
||||
public string osCreateNewPathFindingScene(UUID hostID, UUID scriptID, Vector3 start, Vector3 target)
|
||||
{
|
||||
m_log.Info("[" + Name + "]: Create new Pathfinding scene!");
|
||||
m_log.Info("[" + Name + "]: Create new path scene!");
|
||||
|
||||
String imageName = UUID.Random().ToString();
|
||||
|
||||
|
@ -176,9 +186,12 @@ namespace OpenSim.Modules.PathFinding
|
|||
|
||||
if (_host != null)
|
||||
{
|
||||
//createPathFindingScene(imageName);
|
||||
|
||||
//UUID tid = m_asyncCommands.DataserverPlugin.RegisterRequest(_host.LocalId, _host.GroupID, imageName);
|
||||
|
||||
(new Thread(delegate () { createPathFindingScene(imageName); })).Start();
|
||||
(new Thread(delegate () { createPathFindingScene(scriptID, imageName, start, target); })).Start();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue