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 4d84018..ab18c93 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>
@@ -914,8 +949,12 @@ namespace OpenSim.Region.Framework.Scenes
914 public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) 949 public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID)
915 { 950 {
916 SceneObjectPart part = GetSceneObjectPart(localID); 951 SceneObjectPart part = GetSceneObjectPart(localID);
917 SceneObjectGroup group = part.ParentGroup; 952 SceneObjectGroup group = null;
918 if (group != null) 953 if (part != null)
954 {
955 group = part.ParentGroup;
956 }
957 if (part != null && group != null)
919 { 958 {
920 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) 959 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
921 return; 960 return;
@@ -1490,7 +1529,7 @@ namespace OpenSim.Region.Framework.Scenes
1490 return; 1529 return;
1491 1530
1492 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, 1531 AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType,
1493 Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), 1532 Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"),
1494 remoteClient.AgentId); 1533 remoteClient.AgentId);
1495 AssetService.Store(asset); 1534 AssetService.Store(asset);
1496 1535
@@ -1685,11 +1724,19 @@ namespace OpenSim.Region.Framework.Scenes
1685 // Invalid id 1724 // Invalid id
1686 SceneObjectPart part = GetSceneObjectPart(localID); 1725 SceneObjectPart part = GetSceneObjectPart(localID);
1687 if (part == null) 1726 if (part == null)
1727 {
1728 //Client still thinks the object exists, kill it
1729 SendKillObject(localID);
1688 continue; 1730 continue;
1731 }
1689 1732
1690 // Already deleted by someone else 1733 // Already deleted by someone else
1691 if (part.ParentGroup == null || part.ParentGroup.IsDeleted) 1734 if (part.ParentGroup == null || part.ParentGroup.IsDeleted)
1735 {
1736 //Client still thinks the object exists, kill it
1737 SendKillObject(localID);
1692 continue; 1738 continue;
1739 }
1693 1740
1694 // Can't delete child prims 1741 // Can't delete child prims
1695 if (part != part.ParentGroup.RootPart) 1742 if (part != part.ParentGroup.RootPart)
@@ -1716,15 +1763,21 @@ namespace OpenSim.Region.Framework.Scenes
1716 } 1763 }
1717 else 1764 else
1718 { 1765 {
1719 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) 1766 if (action == DeRezAction.TakeCopy)
1767 {
1768 if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
1769 permissionToTakeCopy = false;
1770 }
1771 else
1772 {
1720 permissionToTakeCopy = false; 1773 permissionToTakeCopy = false;
1774 }
1721 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) 1775 if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
1722 permissionToTake = false; 1776 permissionToTake = false;
1723 1777
1724 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) 1778 if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
1725 permissionToDelete = false; 1779 permissionToDelete = false;
1726 } 1780 }
1727
1728 } 1781 }
1729 1782
1730 // Handle god perms 1783 // Handle god perms