add patch
							parent
							
								
									7ec07954aa
								
							
						
					
					
						commit
						c514ee17ab
					
				|  | @ -0,0 +1,122 @@ | |||
| From 55653416e7380fddc5a9428d17f36079aaf83baf Mon Sep 17 00:00:00 2001 | ||||
| From: Christopher Latza <latzachristopher@live.de> | ||||
| Date: Wed, 10 Jun 2020 01:30:19 +0200 | ||||
| Subject: [PATCH] add os commands to pathfind | ||||
| 
 | ||||
| ---
 | ||||
|  .../Shared/Api/Implementation/OSSL_Api.cs     | 54 +++++++++++++++++++ | ||||
|  .../Shared/Api/Interface/IOSSL_Api.cs         |  4 ++ | ||||
|  .../Shared/Api/Runtime/OSSL_Stub.cs           | 10 ++++ | ||||
|  3 files changed, 68 insertions(+) | ||||
| 
 | ||||
| diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
 | ||||
| index 5e6271c8a7..008640fe31 100644
 | ||||
| --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
 | ||||
| +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
 | ||||
| @@ -42,6 +42,7 @@ using System;
 | ||||
|  using System.Collections; | ||||
|  using System.Collections.Concurrent; | ||||
|  using System.Collections.Generic; | ||||
| +using System.Drawing;
 | ||||
|  using System.Reflection; | ||||
|  using System.Runtime.Remoting.Lifetime; | ||||
|  using System.Text; | ||||
| @@ -756,6 +757,59 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
 | ||||
|              dm.SendAlertToUser(sp.ControllingClient, msg + "\n", false); | ||||
|          } | ||||
|   | ||||
| +
 | ||||
| +        private bool checkIsPositionBlockedByObjekts(LSL_Vector _source)
 | ||||
| +        {
 | ||||
| +            List<SceneObjectGroup> _objects = World.GetSceneObjectGroups().FindAll(X => X.IsPhantom != true && (int)X.AbsolutePosition.X == (int)_source.x && (int)X.AbsolutePosition.Y == (int)_source.y && (int)X.AbsolutePosition.Z <= (m_host.AbsolutePosition.Z + 30));
 | ||||
| +
 | ||||
| +            if (_objects.Count != 0)
 | ||||
| +                return true;
 | ||||
| +
 | ||||
| +            return false;
 | ||||
| +        }
 | ||||
| +
 | ||||
| +        public LSL_List osGetPathfindingPath(LSL_Vector _source, LSL_Vector _target)
 | ||||
| +        {
 | ||||
| +            LSL_List _returnList = new LSL_List();
 | ||||
| +            Bitmap _map = new Bitmap((int)World.RegionInfo.RegionSizeX, (int)World.RegionInfo.RegionSizeY);
 | ||||
| +
 | ||||
| +            for (int X = 0; X <= World.RegionInfo.RegionSizeX; X++)
 | ||||
| +            {
 | ||||
| +                for (int Y = 0; Y <= World.RegionInfo.RegionSizeY; Y++)
 | ||||
| +                {
 | ||||
| +                    float baseheight = (float)World.Heightmap[X, Y];
 | ||||
| +
 | ||||
| +                    if (baseheight <= World.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.Save("debug.png");
 | ||||
| +            return _returnList;
 | ||||
| +        }
 | ||||
| +
 | ||||
| +        public LSL_List osGetObjectIDListByName(LSL_List _nameList)
 | ||||
| +        {
 | ||||
| +            LSL_List _returnList = new LSL_List();
 | ||||
| +
 | ||||
| +            foreach (object o in _nameList.Data)
 | ||||
| +            {
 | ||||
| +                if (o.ToString().Length != 0)
 | ||||
| +                {
 | ||||
| +                    foreach (SceneObjectGroup _objectGroup in World.GetSceneObjectGroups())
 | ||||
| +                    {
 | ||||
| +                        if (_objectGroup.Name.Equals(o.ToString()))
 | ||||
| +                            _returnList.Add(_objectGroup.GroupID);
 | ||||
| +                    }
 | ||||
| +                }
 | ||||
| +            }
 | ||||
| +
 | ||||
| +            return _returnList;
 | ||||
| +        }
 | ||||
| +
 | ||||
|          public void osSetRot(UUID target, Quaternion rotation) | ||||
|          { | ||||
|              // if enabled It can be used to destroy | ||||
| diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
 | ||||
| index 9b4a9ca12d..f7facea065 100644
 | ||||
| --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
 | ||||
| +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
 | ||||
| @@ -134,6 +134,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
 | ||||
|          LSL_Float osTerrainGetHeight(int x, int y); // Deprecated | ||||
|          LSL_Integer osSetTerrainHeight(int x, int y, double val); | ||||
|          LSL_Integer osTerrainSetHeight(int x, int y, double val); //Deprecated | ||||
| +        
 | ||||
| +        LSL_List osGetPathfindingPath(LSL_Types.Vector3 _source, LSL_Types.Vector3 _target);
 | ||||
| +        LSL_List osGetObjectIDListByName(LSL_List _nameList);
 | ||||
| +
 | ||||
|          //ApiDesc Send terrain to all agents | ||||
|          void osTerrainFlush(); | ||||
|   | ||||
| diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
 | ||||
| index ba5158a2ff..518b8f85df 100644
 | ||||
| --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
 | ||||
| +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
 | ||||
| @@ -205,6 +205,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
 | ||||
|              return m_OSSL_Functions.osTerrainSetHeight(x, y, val); | ||||
|          } | ||||
|   | ||||
| +        public LSL_List osGetPathfindingPath(LSL_Types.Vector3 _source, LSL_Types.Vector3 _target)
 | ||||
| +        {
 | ||||
| +            return m_OSSL_Functions.osGetPathfindingPath(_source, _target);
 | ||||
| +        }
 | ||||
| +
 | ||||
| +        public LSL_List osGetObjectIDListByName(LSL_List _nameList)
 | ||||
| +        {
 | ||||
| +            return m_OSSL_Functions.osGetObjectIDListByName(_nameList);
 | ||||
| +        }
 | ||||
| +
 | ||||
|          public void osTerrainFlush() | ||||
|          { | ||||
|              m_OSSL_Functions.osTerrainFlush(); | ||||
| -- 
 | ||||
| 2.27.0.windows.1 | ||||
| 
 | ||||
		Loading…
	
		Reference in New Issue
	
	 Christopher Latza
						Christopher Latza