diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 99 |
1 files changed, 56 insertions, 43 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 838c648..867fb10 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -99,34 +99,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
99 | /// <param name="item"></param> | 99 | /// <param name="item"></param> |
100 | public bool AddInventoryItem(InventoryItemBase item) | 100 | public bool AddInventoryItem(InventoryItemBase item) |
101 | { | 101 | { |
102 | if (UUID.Zero == item.Folder) | 102 | InventoryFolderBase folder; |
103 | |||
104 | if (item.Folder == UUID.Zero) | ||
103 | { | 105 | { |
104 | InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); | 106 | folder = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); |
105 | if (f != null) | 107 | if (folder == null) |
106 | { | ||
107 | // m_log.DebugFormat( | ||
108 | // "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}", | ||
109 | // f.Name, (AssetType)f.Type, item.Name); | ||
110 | |||
111 | item.Folder = f.ID; | ||
112 | } | ||
113 | else | ||
114 | { | 108 | { |
115 | f = InventoryService.GetRootFolder(item.Owner); | 109 | folder = InventoryService.GetRootFolder(item.Owner); |
116 | if (f != null) | 110 | |
117 | { | 111 | if (folder == null) |
118 | item.Folder = f.ID; | ||
119 | } | ||
120 | else | ||
121 | { | ||
122 | m_log.WarnFormat( | ||
123 | "[AGENT INVENTORY]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", | ||
124 | item.Owner, item.Name); | ||
125 | return false; | 112 | return false; |
126 | } | ||
127 | } | 113 | } |
114 | |||
115 | item.Folder = folder.ID; | ||
128 | } | 116 | } |
129 | 117 | ||
130 | if (InventoryService.AddItem(item)) | 118 | if (InventoryService.AddItem(item)) |
131 | { | 119 | { |
132 | int userlevel = 0; | 120 | int userlevel = 0; |
@@ -252,8 +240,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
252 | 240 | ||
253 | // Update item with new asset | 241 | // Update item with new asset |
254 | item.AssetID = asset.FullID; | 242 | item.AssetID = asset.FullID; |
255 | if (group.UpdateInventoryItem(item)) | 243 | group.UpdateInventoryItem(item); |
256 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
257 | 244 | ||
258 | part.GetProperties(remoteClient); | 245 | part.GetProperties(remoteClient); |
259 | 246 | ||
@@ -264,12 +251,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | { | 251 | { |
265 | // Needs to determine which engine was running it and use that | 252 | // Needs to determine which engine was running it and use that |
266 | // | 253 | // |
267 | part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); | 254 | errors = part.Inventory.CreateScriptInstanceEr(item.ItemID, 0, false, DefaultScriptEngine, 0); |
268 | errors = part.Inventory.GetScriptErrors(item.ItemID); | ||
269 | } | ||
270 | else | ||
271 | { | ||
272 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
273 | } | 255 | } |
274 | part.ParentGroup.ResumeScripts(); | 256 | part.ParentGroup.ResumeScripts(); |
275 | return errors; | 257 | return errors; |
@@ -683,6 +665,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
683 | return; | 665 | return; |
684 | } | 666 | } |
685 | 667 | ||
668 | if (newName == null) newName = item.Name; | ||
669 | |||
686 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 670 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); |
687 | 671 | ||
688 | if (asset != null) | 672 | if (asset != null) |
@@ -730,6 +714,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
730 | } | 714 | } |
731 | 715 | ||
732 | /// <summary> | 716 | /// <summary> |
717 | /// Move an item within the agent's inventory, and leave a copy (used in making a new outfit) | ||
718 | /// </summary> | ||
719 | public void MoveInventoryItemsLeaveCopy(IClientAPI remoteClient, List<InventoryItemBase> items, UUID destfolder) | ||
720 | { | ||
721 | List<InventoryItemBase> moveitems = new List<InventoryItemBase>(); | ||
722 | foreach (InventoryItemBase b in items) | ||
723 | { | ||
724 | CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); | ||
725 | InventoryItemBase n = InventoryService.GetItem(b); | ||
726 | n.Folder = destfolder; | ||
727 | moveitems.Add(n); | ||
728 | remoteClient.SendInventoryItemCreateUpdate(n, 0); | ||
729 | } | ||
730 | |||
731 | MoveInventoryItem(remoteClient, moveitems); | ||
732 | } | ||
733 | |||
734 | /// <summary> | ||
733 | /// Move an item within the agent's inventory. | 735 | /// Move an item within the agent's inventory. |
734 | /// </summary> | 736 | /// </summary> |
735 | /// <param name="remoteClient"></param> | 737 | /// <param name="remoteClient"></param> |
@@ -966,8 +968,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
966 | public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) | 968 | public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) |
967 | { | 969 | { |
968 | SceneObjectPart part = GetSceneObjectPart(localID); | 970 | SceneObjectPart part = GetSceneObjectPart(localID); |
969 | SceneObjectGroup group = part.ParentGroup; | 971 | SceneObjectGroup group = null; |
970 | if (group != null) | 972 | if (part != null) |
973 | { | ||
974 | group = part.ParentGroup; | ||
975 | } | ||
976 | if (part != null && group != null) | ||
971 | { | 977 | { |
972 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) | 978 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) |
973 | return; | 979 | return; |
@@ -1414,13 +1420,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1414 | { | 1420 | { |
1415 | agentTransactions.HandleTaskItemUpdateFromTransaction( | 1421 | agentTransactions.HandleTaskItemUpdateFromTransaction( |
1416 | remoteClient, part, transactionID, currentItem); | 1422 | remoteClient, part, transactionID, currentItem); |
1417 | |||
1418 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | ||
1419 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | ||
1420 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | ||
1421 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
1422 | else | ||
1423 | remoteClient.SendAgentAlertMessage("Item saved", false); | ||
1424 | } | 1423 | } |
1425 | 1424 | ||
1426 | // Base ALWAYS has move | 1425 | // Base ALWAYS has move |
@@ -1548,7 +1547,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1548 | return; | 1547 | return; |
1549 | 1548 | ||
1550 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1549 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1551 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1550 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1552 | remoteClient.AgentId); | 1551 | remoteClient.AgentId); |
1553 | AssetService.Store(asset); | 1552 | AssetService.Store(asset); |
1554 | 1553 | ||
@@ -1743,11 +1742,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1743 | // Invalid id | 1742 | // Invalid id |
1744 | SceneObjectPart part = GetSceneObjectPart(localID); | 1743 | SceneObjectPart part = GetSceneObjectPart(localID); |
1745 | if (part == null) | 1744 | if (part == null) |
1745 | { | ||
1746 | //Client still thinks the object exists, kill it | ||
1747 | SendKillObject(localID); | ||
1746 | continue; | 1748 | continue; |
1749 | } | ||
1747 | 1750 | ||
1748 | // Already deleted by someone else | 1751 | // Already deleted by someone else |
1749 | if (part.ParentGroup == null || part.ParentGroup.IsDeleted) | 1752 | if (part.ParentGroup == null || part.ParentGroup.IsDeleted) |
1753 | { | ||
1754 | //Client still thinks the object exists, kill it | ||
1755 | SendKillObject(localID); | ||
1750 | continue; | 1756 | continue; |
1757 | } | ||
1751 | 1758 | ||
1752 | // Can't delete child prims | 1759 | // Can't delete child prims |
1753 | if (part != part.ParentGroup.RootPart) | 1760 | if (part != part.ParentGroup.RootPart) |
@@ -1769,15 +1776,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1769 | } | 1776 | } |
1770 | else | 1777 | else |
1771 | { | 1778 | { |
1772 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 1779 | if (action == DeRezAction.TakeCopy) |
1780 | { | ||
1781 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
1782 | permissionToTakeCopy = false; | ||
1783 | } | ||
1784 | else | ||
1785 | { | ||
1773 | permissionToTakeCopy = false; | 1786 | permissionToTakeCopy = false; |
1787 | } | ||
1774 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 1788 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1775 | permissionToTake = false; | 1789 | permissionToTake = false; |
1776 | 1790 | ||
1777 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 1791 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1778 | permissionToDelete = false; | 1792 | permissionToDelete = false; |
1779 | } | 1793 | } |
1780 | |||
1781 | } | 1794 | } |
1782 | 1795 | ||
1783 | // Handle god perms | 1796 | // Handle god perms |