1
0
Fork 0
4Creative-Changes/Patch/0001-add-os-commands-to-pat...

140 lines
5.8 KiB
Diff
Raw Normal View History

2020-06-10 07:20:15 +00:00
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
2020-06-09 23:31:53 +00:00
---
2020-06-10 07:20:15 +00:00
.../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(-)
2020-06-09 23:31:53 +00:00
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
2020-06-10 07:20:15 +00:00
index 9b4a9ca12d..ac5f5bda1e 100644
2020-06-09 23:31:53 +00:00
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
2020-06-10 07:20:15 +00:00
@@ -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
{
2020-06-09 23:31:53 +00:00
@@ -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
+
2020-06-10 07:20:15 +00:00
+ LSL_List osGetPathfindingPath(LSL_Vector _source, LSL_Vector _target);
2020-06-09 23:31:53 +00:00
+ 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
2020-06-10 07:20:15 +00:00
index ba5158a2ff..f79c90e2cb 100644
2020-06-09 23:31:53 +00:00
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
2020-06-10 07:20:15 +00:00
@@ -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
2020-06-09 23:31:53 +00:00
return m_OSSL_Functions.osTerrainSetHeight(x, y, val);
}
2020-06-10 07:20:15 +00:00
+ public LSL_List osGetPathfindingPath(LSL_Vector _source, LSL_Vector _target)
2020-06-09 23:31:53 +00:00
+ {
+ 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();
--
2020-06-10 07:20:15 +00:00
2.25.1.windows.1
2020-06-09 23:31:53 +00:00