add answer to script

master
Christopher Latza 2020-06-10 22:32:49 +02:00
parent fea47de571
commit 413dd571ee
1 changed files with 33 additions and 20 deletions

View File

@ -135,7 +135,9 @@ namespace OpenSim.Modules.PathFinding
#region Script Funktions #region Script Funktions
private void createPathFindingScene(String imageName) private void createPathFindingScene(UUID script, String imageName, Vector3 start, Vector3 target)
{
try
{ {
Bitmap _map = new Bitmap((int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY); Bitmap _map = new Bitmap((int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY);
@ -156,17 +158,25 @@ namespace OpenSim.Modules.PathFinding
} }
} }
_map.SetPixel(0, 0, Color.White); _map.SetPixel((int)start.X, (int)start.Y, Color.Aqua);
PathFindingSceneGenerator.DrawObjectVolume(m_scene, ref _map); PathFindingSceneGenerator.DrawObjectVolume(m_scene, ref _map);
_map.Save(imageName + ".png", ImageFormat.Png); _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);
}
} }
[ScriptInvocation] [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(); String imageName = UUID.Random().ToString();
@ -176,9 +186,12 @@ namespace OpenSim.Modules.PathFinding
if (_host != null) if (_host != null)
{ {
//createPathFindingScene(imageName);
//UUID tid = m_asyncCommands.DataserverPlugin.RegisterRequest(_host.LocalId, _host.GroupID, 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 else
{ {