aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs80
1 files changed, 34 insertions, 46 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 357cdc4..bf4c91f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -35,7 +35,6 @@ using OpenMetaverse;
35using OpenMetaverse.Packets; 35using OpenMetaverse.Packets;
36using log4net; 36using log4net;
37using OpenSim.Framework; 37using OpenSim.Framework;
38
39using OpenSim.Region.Framework; 38using OpenSim.Region.Framework;
40using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes.Serialization; 40using OpenSim.Region.Framework.Scenes.Serialization;
@@ -64,6 +63,7 @@ namespace OpenSim.Region.Framework.Scenes
64 if (group is SceneObjectGroup) 63 if (group is SceneObjectGroup)
65 { 64 {
66 ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0); 65 ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
66 ((SceneObjectGroup) group).ResumeScripts();
67 } 67 }
68 } 68 }
69 } 69 }
@@ -218,6 +218,7 @@ namespace OpenSim.Region.Framework.Scenes
218 { 218 {
219 remoteClient.SendAgentAlertMessage("Script saved", false); 219 remoteClient.SendAgentAlertMessage("Script saved", false);
220 } 220 }
221 part.ParentGroup.ResumeScripts();
221 return errors; 222 return errors;
222 } 223 }
223 224
@@ -471,7 +472,6 @@ namespace OpenSim.Region.Framework.Scenes
471 return null; 472 return null;
472 } 473 }
473 474
474
475 if (recipientParentFolderId == UUID.Zero) 475 if (recipientParentFolderId == UUID.Zero)
476 { 476 {
477 InventoryFolderBase recipientRootFolder = InventoryService.GetRootFolder(recipientId); 477 InventoryFolderBase recipientRootFolder = InventoryService.GetRootFolder(recipientId);
@@ -721,6 +721,37 @@ namespace OpenSim.Region.Framework.Scenes
721 } 721 }
722 } 722 }
723 723
724 private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID,
725 uint callbackID, string description, string name,
726 sbyte invType, sbyte type, UUID olditemID)
727 {
728 m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item link {0} in folder {1} pointing to {2}", name, folderID, olditemID);
729
730 if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
731 return;
732
733 ScenePresence presence;
734 if (TryGetScenePresence(remoteClient.AgentId, out presence))
735 {
736 byte[] data = null;
737
738 AssetBase asset = new AssetBase();
739 asset.FullID = olditemID;
740 asset.Type = type;
741 asset.Name = name;
742 asset.Description = description;
743
744 CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), folderID, name, 0, callbackID, asset, invType, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch());
745
746 }
747 else
748 {
749 m_log.ErrorFormat(
750 "ScenePresence for agent uuid {0} unexpectedly not found in HandleLinkInventoryItem",
751 remoteClient.AgentId);
752 }
753 }
754
724 /// <summary> 755 /// <summary>
725 /// Remove an inventory item for the client's inventory 756 /// Remove an inventory item for the client's inventory
726 /// </summary> 757 /// </summary>
@@ -1163,6 +1194,7 @@ namespace OpenSim.Region.Framework.Scenes
1163 item = LibraryService.LibraryRootFolder.FindItem(itemID); 1194 item = LibraryService.LibraryRootFolder.FindItem(itemID);
1164 } 1195 }
1165 1196
1197 // If we've found the item in the user's inventory or in the library
1166 if (item != null) 1198 if (item != null)
1167 { 1199 {
1168 part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); 1200 part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID);
@@ -1841,50 +1873,6 @@ namespace OpenSim.Region.Framework.Scenes
1841 EventManager.TriggerStopScript(part.LocalId, itemID); 1873 EventManager.TriggerStopScript(part.LocalId, itemID);
1842 } 1874 }
1843 1875
1844 internal void SendAttachEvent(uint localID, UUID itemID, UUID avatarID)
1845 {
1846 EventManager.TriggerOnAttach(localID, itemID, avatarID);
1847 }
1848
1849 public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
1850 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
1851 {
1852 foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
1853 {
1854 AttachmentsModule.RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt);
1855 }
1856 }
1857
1858 public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient)
1859 {
1860 SceneObjectPart part = GetSceneObjectPart(itemID);
1861 if (part == null || part.ParentGroup == null)
1862 return;
1863
1864 UUID inventoryID = part.ParentGroup.GetFromItemID();
1865
1866 ScenePresence presence;
1867 if (TryGetScenePresence(remoteClient.AgentId, out presence))
1868 {
1869 if (!Permissions.CanRezObject(part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition))
1870 return;
1871
1872 presence.Appearance.DetachAttachment(itemID);
1873 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
1874 if (ava != null)
1875 {
1876 ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
1877 }
1878 part.ParentGroup.DetachToGround();
1879
1880 List<UUID> uuids = new List<UUID>();
1881 uuids.Add(inventoryID);
1882 InventoryService.DeleteItems(remoteClient.AgentId, uuids);
1883 remoteClient.SendRemoveInventoryItem(inventoryID);
1884 }
1885 SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero);
1886 }
1887
1888 public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) 1876 public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
1889 { 1877 {
1890 EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID); 1878 EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID);