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.cs67
1 files changed, 60 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 01edf51..17159b4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -94,6 +94,22 @@ namespace OpenSim.Region.Framework.Scenes
94 94
95 public void AddInventoryItem(UUID AgentID, InventoryItemBase item) 95 public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
96 { 96 {
97 InventoryFolderBase folder;
98
99 if (item.Folder == UUID.Zero)
100 {
101 folder = InventoryService.GetFolderForType(AgentID, (AssetType)item.AssetType);
102 if (folder == null)
103 {
104 folder = InventoryService.GetRootFolder(AgentID);
105
106 if (folder == null)
107 return;
108 }
109
110 item.Folder = folder.ID;
111 }
112
97 if (InventoryService.AddItem(item)) 113 if (InventoryService.AddItem(item))
98 { 114 {
99 int userlevel = 0; 115 int userlevel = 0;
@@ -214,8 +230,7 @@ namespace OpenSim.Region.Framework.Scenes
214 { 230 {
215 // Needs to determine which engine was running it and use that 231 // Needs to determine which engine was running it and use that
216 // 232 //
217 part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); 233 errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0);
218 errors = part.Inventory.GetScriptErrors(item.ItemID);
219 } 234 }
220 else 235 else
221 { 236 {
@@ -633,6 +648,8 @@ namespace OpenSim.Region.Framework.Scenes
633 return; 648 return;
634 } 649 }
635 650
651 if (newName == null) newName = item.Name;
652
636 AssetBase asset = AssetService.Get(item.AssetID.ToString()); 653 AssetBase asset = AssetService.Get(item.AssetID.ToString());
637 654
638 if (asset != null) 655 if (asset != null)
@@ -680,6 +697,24 @@ namespace OpenSim.Region.Framework.Scenes
680 } 697 }
681 698
682 /// <summary> 699 /// <summary>
700 /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit)
701 /// </summary>
702 public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder)
703 {
704 List<InventoryItemBase> moveitems = new List<InventoryItemBase>();
705 foreach (InventoryItemBase b in items)
706 {
707 CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null);
708 InventoryItemBase n = InventoryService.GetItem(b);
709 n.Folder = destfolder;
710 moveitems.Add(n);
711 remoteClient.SendInventoryItemCreateUpdate(n, 0);
712 }
713
714 MoveInventoryItem(remoteClient, moveitems);
715 }
716
717 /// <summary>
683 /// Move an item within the agent's inventory. 718 /// Move an item within the agent's inventory.
684 /// </summary> 719 /// </summary>
685 /// <param name="remoteClient"></param> 720 /// <param name="remoteClient"></param>
@@ -913,8 +948,12 @@ namespace OpenSim.Region.Framework.Scenes
913 public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) 948 public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID)
914 { 949 {
915 SceneObjectPart part = GetSceneObjectPart(localID); 950 SceneObjectPart part = GetSceneObjectPart(localID);
916 SceneObjectGroup group = part.ParentGroup; 951 SceneObjectGroup group = null;
917 if (group != null) 952 if (part != null)
953 {
954 group = part.ParentGroup;
955 }
956 if (part != null && group != null)
918 { 957 {
919 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) 958 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
920 return; 959 return;
@@ -1489,7 +1528,7 @@ namespace OpenSim.Region.Framework.Scenes
1489 return; 1528 return;
1490 1529
1491 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, 1530 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType,
1492 Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), 1531 Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"),
1493 remoteClient.AgentId); 1532 remoteClient.AgentId);
1494 AssetService.Store(asset); 1533 AssetService.Store(asset);
1495 1534
@@ -1684,11 +1723,19 @@ namespace OpenSim.Region.Framework.Scenes
1684 // Invalid id 1723 // Invalid id
1685 SceneObjectPart part = GetSceneObjectPart(localID); 1724 SceneObjectPart part = GetSceneObjectPart(localID);
1686 if (part == null) 1725 if (part == null)
1726 {
1727 //Client still thinks the object exists, kill it
1728 SendKillObject(localID);
1687 continue; 1729 continue;
1730 }
1688 1731
1689 // Already deleted by someone else 1732 // Already deleted by someone else
1690 if (part.ParentGroup == null || part.ParentGroup.IsDeleted) 1733 if (part.ParentGroup == null || part.ParentGroup.IsDeleted)
1734 {
1735 //Client still thinks the object exists, kill it
1736 SendKillObject(localID);
1691 continue; 1737 continue;
1738 }
1692 1739
1693 // Can't delete child prims 1740 // Can't delete child prims
1694 if (part != part.ParentGroup.RootPart) 1741 if (part != part.ParentGroup.RootPart)
@@ -1715,15 +1762,21 @@ namespace OpenSim.Region.Framework.Scenes
1715 } 1762 }
1716 else 1763 else
1717 { 1764 {
1718 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) 1765 if (action == DeRezAction.TakeCopy)
1766 {
1767 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
1768 permissionToTakeCopy = false;
1769 }
1770 else
1771 {
1719 permissionToTakeCopy = false; 1772 permissionToTakeCopy = false;
1773 }
1720 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) 1774 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
1721 permissionToTake = false; 1775 permissionToTake = false;
1722 1776
1723 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) 1777 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
1724 permissionToDelete = false; 1778 permissionToDelete = false;
1725 } 1779 }
1726
1727 } 1780 }
1728 1781
1729 // Handle god perms 1782 // Handle god perms