From a1ca6409dd6789905a02d84f8c0f184167d83ee1 Mon Sep 17 00:00:00 2001 From: Christopher Latza Date: Wed, 10 Jun 2020 18:03:33 +0200 Subject: [PATCH] add to thread --- src/BasicPathFinding.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/BasicPathFinding.cs b/src/BasicPathFinding.cs index ccaf647..6641f7e 100644 --- a/src/BasicPathFinding.cs +++ b/src/BasicPathFinding.cs @@ -7,11 +7,13 @@ using OpenSim.Region.Framework.Scenes; using System; using System.Collections.Generic; using System.Drawing; +using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Security.Cryptography; using System.Text; +using System.Threading; using System.Timers; [assembly: Addin("BasicPathFindingModule", "0.1")] @@ -131,26 +133,37 @@ namespace OpenSim.Modules.PathFinding return false; } - [ScriptInvocation] - public string osCreateNewPathFindingScene(UUID hostID, UUID scriptID) + private void createTestImage() { Bitmap _map = new Bitmap((int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY); for (int X = 0; X <= m_scene.RegionInfo.RegionSizeX; X++) { + m_log.Info("X: " + X); for (int Y = 0; Y <= m_scene.RegionInfo.RegionSizeY; Y++) { + m_log.Info("Y: " + Y); + + _map.SetPixel(X, Y, Color.Green); + float baseheight = (float)m_scene.Heightmap[X, Y]; if (baseheight <= m_scene.RegionInfo.RegionSettings.WaterHeight) _map.SetPixel(X, Y, Color.Red); //if (checkIsPositionBlockedByObjekts(new LSL_Vector(X, Y, 0)) == true) - //_map.SetPixel(X, Y, Color.Yellow); + //_map.SetPixel(X, Y, Color.Yellow); } } - _map.Save("debug.png"); + _map.Save("debug.png", ImageFormat.Png); + } + + [ScriptInvocation] + public string osCreateNewPathFindingScene(UUID hostID, UUID scriptID) + { + + (new Thread(delegate () { createTestImage(); })).Start(); return ""; }