From 4cce1cc26ed8832764408fd44a279301eb55aa80 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 13 May 2009 02:06:12 +0000 Subject: Implement llDetachFromAvatar() --- .../Shared/Api/Implementation/LSL_Api.cs | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e2bdd59..5700be5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2712,7 +2712,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llDetachFromAvatar() { m_host.AddScriptLPS(1); - NotImplemented("llDetachFromAvatar"); + + if (m_host.ParentGroup.RootPart.AttachmentPoint == 0) + return; + + TaskInventoryItem item; + + lock (m_host.TaskInventory) + { + if (!m_host.TaskInventory.ContainsKey(InventorySelf())) + return; + else + item = m_host.TaskInventory[InventorySelf()]; + } + + if (item.PermsGranter != m_host.OwnerID) + return; + + if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) + { + SceneObjectGroup grp = m_host.ParentGroup; + UUID itemID = grp.GetFromAssetID(); + + ScenePresence presence = World.GetScenePresence(m_host.OwnerID); + + m_ScriptEngine.World.DetachSingleAttachmentToInv(itemID, + presence.ControllingClient); + } } public void llTakeCamera(string avatar) -- cgit v1.1