From e53f4399812224939e4ebec6790a9addb38cca95 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 26 Jun 2017 20:42:49 +0100 Subject: [PATCH] add osGetNPCList() --- .../Shared/Api/Implementation/OSSL_Api.cs | 19 +++++++++++++++++++ .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ bin/config-include/osslEnable.ini | 1 + 4 files changed, 26 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 823a4e5564..fa7ee21143 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3835,6 +3835,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return result; } + public LSL_List osGetNPCList() + { + CheckThreatLevel(ThreatLevel.None, "osGetNPCList"); + m_host.AddScriptLPS(1); + + LSL_List result = new LSL_List(); + World.ForEachRootScenePresence(delegate (ScenePresence avatar) + { + if (avatar != null && avatar.IsNPC) + { + result.Add(new LSL_String(avatar.UUID.ToString())); + result.Add(new LSL_Vector(avatar.AbsolutePosition)); + result.Add(new LSL_String(avatar.Name)); + } + }); + + return result; + } + /// /// Convert a unix time to a llGetTimestamp() like string /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index f7857da7a8..6e6a0be81d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -395,6 +395,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb); LSL_List osGetAvatarList(); + LSL_List osGetNPCList(); LSL_String osUnixTimeToTimestamp(long time); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index d6af32b4b9..43113b8d17 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -1041,6 +1041,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osGetAvatarList(); } + public LSL_List osGetNPCList() + { + return m_OSSL_Functions.osGetNPCList(); + } + public LSL_String osUnixTimeToTimestamp(long time) { return m_OSSL_Functions.osUnixTimeToTimestamp(time); diff --git a/bin/config-include/osslEnable.ini b/bin/config-include/osslEnable.ini index 1d7f25b7cf..99c5ffff32 100644 --- a/bin/config-include/osslEnable.ini +++ b/bin/config-include/osslEnable.ini @@ -97,6 +97,7 @@ ; Allow_osGetInventoryDesc = true ; no level check ; Allow_osGetLinkNumber = true ; no level check ; Allow_osGetMapTexture = true ; no level check + Allow_osGetNPCList = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER ; Allow_osGetRegionSize = true ; no level check Allow_osGetRezzingObject = true ; Allow_osGetSunParam = true ; no level check