cleanup
parent
09bd26c00e
commit
4e86ff2a47
|
@ -117,12 +117,7 @@ namespace OpenSim.Modules.PathFinding
|
||||||
m_enabled = false;
|
m_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scriptEngine = m_scene.RequestModuleInterface<IScriptEngine>();
|
m_log.Info("[" + Name + "]: Region loading done!");
|
||||||
|
|
||||||
if(m_scriptEngine != null)
|
|
||||||
{
|
|
||||||
m_asyncCommands = new AsyncCommandManager(m_scriptEngine);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,62 +130,6 @@ namespace OpenSim.Modules.PathFinding
|
||||||
|
|
||||||
#region Script Funktions
|
#region Script Funktions
|
||||||
|
|
||||||
private bool drawAllBlocketPositions(ref Bitmap _map)
|
|
||||||
{
|
|
||||||
List<SceneObjectGroup> _objects = m_scene.GetSceneObjectGroups().FindAll(X => X.IsPhantom != true);
|
|
||||||
|
|
||||||
foreach(SceneObjectGroup _object in _objects)
|
|
||||||
{
|
|
||||||
SceneObjectPart[] _parts = _object.Parts;
|
|
||||||
|
|
||||||
foreach (SceneObjectPart _part in _parts)
|
|
||||||
{
|
|
||||||
if(!_part.Description.Contains("ignorepathfinding"))
|
|
||||||
{
|
|
||||||
Vector2 _start = new Vector2(_part.AbsolutePosition.X - ((int)_part.Scale.X / 2), _part.AbsolutePosition.Y - ((int)_part.Scale.Y / 2));
|
|
||||||
Vector2 _end = new Vector2(_part.AbsolutePosition.X + ((int)_part.Scale.X / 2), _part.AbsolutePosition.Y + ((int)_part.Scale.Y / 2));
|
|
||||||
|
|
||||||
fillArea(ref _map, _start, _end, Color.Red);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool drawAllAllowedPaths(ref Bitmap _map)
|
|
||||||
{
|
|
||||||
foreach (SceneObjectGroup _object in m_scene.GetSceneObjectGroups())
|
|
||||||
{
|
|
||||||
SceneObjectPart[] _parts = _object.Parts;
|
|
||||||
|
|
||||||
foreach (SceneObjectPart _part in _parts)
|
|
||||||
{
|
|
||||||
if (_part.Description.Contains("allowedpath") || _part.Description.Contains("pathfinding_allow"))
|
|
||||||
{
|
|
||||||
Vector2 _start = new Vector2(_part.AbsolutePosition.X - ((int)_part.Scale.X / 2), _part.AbsolutePosition.Y - ((int)_part.Scale.Y / 2));
|
|
||||||
Vector2 _end = new Vector2(_part.AbsolutePosition.X + ((int)_part.Scale.X / 2), _part.AbsolutePosition.Y + ((int)_part.Scale.Y / 2));
|
|
||||||
|
|
||||||
fillArea(ref _map, _start, _end, Color.Green);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fillArea(ref Bitmap _map, Vector2 _start, Vector2 _end, Color _color)
|
|
||||||
{
|
|
||||||
for (int X = (int)_start.X; X < (int)_end.X; X++)
|
|
||||||
{
|
|
||||||
for (int Y = (int)_start.Y; Y < (int)_end.Y; Y++)
|
|
||||||
{
|
|
||||||
if(Y >= 0 && Y >= 0 && X > _map.Size.Height && Y > _map.Size.Width)
|
|
||||||
_map.SetPixel(X, Y, _color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createPathFindingScene(String imageName)
|
private void createPathFindingScene(String imageName)
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
@ -201,47 +140,26 @@ namespace OpenSim.Modules.PathFinding
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
for (int X = 0; X < m_scene.RegionInfo.RegionSizeX; X++)
|
|
||||||
{
|
|
||||||
for (int Y = 0; Y < m_scene.RegionInfo.RegionSizeY; Y++)
|
|
||||||
{
|
|
||||||
float baseheight = (float)m_scene.Heightmap[X, Y];
|
|
||||||
|
|
||||||
if (baseheight <= m_scene.RegionInfo.RegionSettings.WaterHeight)
|
|
||||||
_map.SetPixel(Y, X, Color.Blue);
|
|
||||||
|
|
||||||
if (baseheight > m_scene.RegionInfo.RegionSettings.WaterHeight)
|
|
||||||
_map.SetPixel(Y, X, Color.Yellow);
|
|
||||||
|
|
||||||
//drawAllBlocketPositions(ref _map);
|
|
||||||
|
|
||||||
//drawAllAllowedPaths(ref _map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ScriptInvocation]
|
[ScriptInvocation]
|
||||||
public string osCreateNewPathFindingScene(UUID hostID, UUID scriptID)
|
public string osCreateNewPathFindingScene(UUID hostID, UUID scriptID)
|
||||||
{
|
{
|
||||||
|
m_log.Info("[" + Name + "]: Create new Pathfinding scene!");
|
||||||
|
|
||||||
String imageName = UUID.Random().ToString();
|
String imageName = UUID.Random().ToString();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SceneObjectGroup _host = m_scene.GetSceneObjectGroup(hostID);
|
SceneObjectGroup _host = m_scene.GetSceneObjectGroup(hostID);
|
||||||
|
|
||||||
if (_host != null || m_asyncCommands != null)
|
if (_host != null)
|
||||||
{
|
{
|
||||||
UUID tid = m_asyncCommands.DataserverPlugin.RegisterRequest(_host.LocalId, _host.GroupID, imageName);
|
|
||||||
|
|
||||||
(new Thread(delegate () { createPathFindingScene(imageName); })).Start();
|
(new Thread(delegate () { createPathFindingScene(imageName); })).Start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_host == null)
|
m_log.ErrorFormat("[" + Name + "]: Host is null");
|
||||||
m_log.ErrorFormat("[" + Name + "]: Host is null");
|
|
||||||
|
|
||||||
if (m_asyncCommands == null)
|
|
||||||
m_log.ErrorFormat("[" + Name + "]: AsyncCommands is null");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception _error)
|
catch(Exception _error)
|
||||||
|
|
Loading…
Reference in New Issue