diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 67 |
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 379128a..48508f8 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; |
@@ -1496,7 +1535,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1496 | return; | 1535 | return; |
1497 | 1536 | ||
1498 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1537 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1499 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1538 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1500 | remoteClient.AgentId); | 1539 | remoteClient.AgentId); |
1501 | AssetService.Store(asset); | 1540 | AssetService.Store(asset); |
1502 | 1541 | ||
@@ -1691,11 +1730,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1691 | // Invalid id | 1730 | // Invalid id |
1692 | SceneObjectPart part = GetSceneObjectPart(localID); | 1731 | SceneObjectPart part = GetSceneObjectPart(localID); |
1693 | if (part == null) | 1732 | if (part == null) |
1733 | { | ||
1734 | //Client still thinks the object exists, kill it | ||
1735 | SendKillObject(localID); | ||
1694 | continue; | 1736 | continue; |
1737 | } | ||
1695 | 1738 | ||
1696 | // Already deleted by someone else | 1739 | // Already deleted by someone else |
1697 | if (part.ParentGroup == null || part.ParentGroup.IsDeleted) | 1740 | if (part.ParentGroup == null || part.ParentGroup.IsDeleted) |
1741 | { | ||
1742 | //Client still thinks the object exists, kill it | ||
1743 | SendKillObject(localID); | ||
1698 | continue; | 1744 | continue; |
1745 | } | ||
1699 | 1746 | ||
1700 | // Can't delete child prims | 1747 | // Can't delete child prims |
1701 | if (part != part.ParentGroup.RootPart) | 1748 | if (part != part.ParentGroup.RootPart) |
@@ -1722,15 +1769,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1722 | } | 1769 | } |
1723 | else | 1770 | else |
1724 | { | 1771 | { |
1725 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 1772 | if (action == DeRezAction.TakeCopy) |
1773 | { | ||
1774 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
1775 | permissionToTakeCopy = false; | ||
1776 | } | ||
1777 | else | ||
1778 | { | ||
1726 | permissionToTakeCopy = false; | 1779 | permissionToTakeCopy = false; |
1780 | } | ||
1727 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 1781 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1728 | permissionToTake = false; | 1782 | permissionToTake = false; |
1729 | 1783 | ||
1730 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 1784 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1731 | permissionToDelete = false; | 1785 | permissionToDelete = false; |
1732 | } | 1786 | } |
1733 | |||
1734 | } | 1787 | } |
1735 | 1788 | ||
1736 | // Handle god perms | 1789 | // Handle god perms |