From b0f87fba1c4238a042a0b7112d792815dd10b737 Mon Sep 17 00:00:00 2001 From: Mandarinka Tasty Date: Fri, 4 Nov 2016 06:24:56 +0100 Subject: [PATCH 1/2] Implementation of new LSL function: list llGetAttachedList(key avatar); It also returns HUDs' keys. Signed-off-by: Mandarinka Tasty Signed-off-by: UbitUmarov --- .../Shared/Api/Implementation/LSL_Api.cs | 26 +++++++++++++++++++ .../Shared/Api/Interface/ILSL_Api.cs | 1 + .../Shared/Api/Runtime/LSL_Stub.cs | 5 ++++ 3 files changed, 32 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 85837e4eef..5f8734758c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7022,6 +7022,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return m_host.ParentGroup.AttachmentPoint; } + public LSL_List llGetAttachedList(string id) + { + m_host.AddScriptLPS(1); + + LSL_List AttachmentsList = new LSL_List(); + + ScenePresence av = World.GetScenePresence((UUID)id); + + string NOT_FOUND = "NOT_FOUND"; + string NOT_ON_REGION = "NOT ON REGION"; + + if (av == null) + return new LSL_List(NOT_FOUND); + if (av.IsChildAgent) + return new LSL_List(NOT_ON_REGION); + + List AttachmentsKeys; + + AttachmentsKeys = av.GetAttachments(); + + foreach (SceneObjectGroup AttachmentKey in AttachmentsKeys) + AttachmentsList.Add(new LSL_Key(AttachmentKey.FromItemID.ToString())); + + return AttachmentsList; + } + public virtual LSL_Integer llGetFreeMemory() { m_host.AddScriptLPS(1); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 8b8638c935..3d1482d921 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -116,6 +116,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String llGetAnimation(string id); LSL_List llGetAnimationList(string id); LSL_Integer llGetAttached(); + LSL_List llGetAttachedList(string id); LSL_List llGetBoundingBox(string obj); LSL_Vector llGetCameraPos(); LSL_Rotation llGetCameraRot(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index cea66d2c5f..2769712f2a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -426,6 +426,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llGetAttached(); } + public LSL_List llGetAttachedList(string id) + { + return m_LSL_Functions.llGetAttachedList(id); + } + public LSL_List llGetBoundingBox(string obj) { return m_LSL_Functions.llGetBoundingBox(obj); From 9b78eb20c0a7b1907fec67dc2104756f6d2a96d5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 4 Nov 2016 11:58:52 +0000 Subject: [PATCH 2/2] by design HUD objects are private --- .../Shared/Api/Implementation/LSL_Api.cs | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5f8734758c..ced81ada3e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7026,24 +7026,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - LSL_List AttachmentsList = new LSL_List(); - ScenePresence av = World.GetScenePresence((UUID)id); - string NOT_FOUND = "NOT_FOUND"; - string NOT_ON_REGION = "NOT ON REGION"; + if (av == null || av.IsDeleted) + return new LSL_List("NOT_FOUND"); - if (av == null) - return new LSL_List(NOT_FOUND); - if (av.IsChildAgent) - return new LSL_List(NOT_ON_REGION); + if (av.IsChildAgent || av.IsInTransit) + return new LSL_List("NOT_ON_REGION"); - List AttachmentsKeys; + LSL_List AttachmentsList = new LSL_List(); + List Attachments; - AttachmentsKeys = av.GetAttachments(); + Attachments = av.GetAttachments(); - foreach (SceneObjectGroup AttachmentKey in AttachmentsKeys) - AttachmentsList.Add(new LSL_Key(AttachmentKey.FromItemID.ToString())); + foreach (SceneObjectGroup Attachment in Attachments) + { + if(Attachment.HasPrivateAttachmentPoint) + continue; + AttachmentsList.Add(new LSL_Key(Attachment.UUID.ToString())); + } return AttachmentsList; }