140 lines
5.8 KiB
Diff
140 lines
5.8 KiB
Diff
From e502bb78dd38482366c3b4675226265bae668bdd Mon Sep 17 00:00:00 2001
|
|
From: Christopher <git@clatza.dev>
|
|
Date: Wed, 10 Jun 2020 09:19:20 +0200
|
|
Subject: [PATCH] change pathfinding args
|
|
|
|
---
|
|
.../Shared/Api/Implementation/OSSL_Api.cs | 54 +++++++++++++++++++
|
|
.../Shared/Api/Interface/IOSSL_Api.cs | 6 ++-
|
|
.../Shared/Api/Runtime/OSSL_Stub.cs | 11 ++++
|
|
3 files changed, 70 insertions(+), 1 deletion(-)
|
|
|
|
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..ac5f5bda1e 100644
|
|
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
|
|
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
|
|
@@ -38,7 +38,7 @@ using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
|
|
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
|
|
using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
|
|
using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
|
-
|
|
+using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
|
|
|
|
namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|
{
|
|
@@ -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_Vector _source, LSL_Vector _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..f79c90e2cb 100644
|
|
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
|
|
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
|
|
@@ -44,6 +44,7 @@ using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
|
using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
|
|
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
|
|
using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
|
|
+using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
|
|
|
|
namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|
{
|
|
@@ -205,6 +206,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|
return m_OSSL_Functions.osTerrainSetHeight(x, y, val);
|
|
}
|
|
|
|
+ public LSL_List osGetPathfindingPath(LSL_Vector _source, LSL_Vector _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.25.1.windows.1
|
|
|