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 1bf6b87..9a33993 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> |
@@ -972,8 +974,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
972 | public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) | 974 | public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) |
973 | { | 975 | { |
974 | SceneObjectPart part = GetSceneObjectPart(localID); | 976 | SceneObjectPart part = GetSceneObjectPart(localID); |
975 | SceneObjectGroup group = part.ParentGroup; | 977 | SceneObjectGroup group = null; |
976 | if (group != null) | 978 | if (part != null) |
979 | { | ||
980 | group = part.ParentGroup; | ||
981 | } | ||
982 | if (part != null && group != null) | ||
977 | { | 983 | { |
978 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) | 984 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) |
979 | return; | 985 | return; |
@@ -1420,13 +1426,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1420 | { | 1426 | { |
1421 | agentTransactions.HandleTaskItemUpdateFromTransaction( | 1427 | agentTransactions.HandleTaskItemUpdateFromTransaction( |
1422 | remoteClient, part, transactionID, currentItem); | 1428 | remoteClient, part, transactionID, currentItem); |
1423 | |||
1424 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | ||
1425 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | ||
1426 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | ||
1427 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
1428 | else | ||
1429 | remoteClient.SendAgentAlertMessage("Item saved", false); | ||
1430 | } | 1429 | } |
1431 | 1430 | ||
1432 | // Base ALWAYS has move | 1431 | // Base ALWAYS has move |
@@ -1544,7 +1543,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1544 | return; | 1543 | return; |
1545 | 1544 | ||
1546 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1545 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1547 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1546 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1548 | remoteClient.AgentId); | 1547 | remoteClient.AgentId); |
1549 | AssetService.Store(asset); | 1548 | AssetService.Store(asset); |
1550 | 1549 | ||
@@ -1739,11 +1738,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1739 | // Invalid id | 1738 | // Invalid id |
1740 | SceneObjectPart part = GetSceneObjectPart(localID); | 1739 | SceneObjectPart part = GetSceneObjectPart(localID); |
1741 | if (part == null) | 1740 | if (part == null) |
1741 | { | ||
1742 | //Client still thinks the object exists, kill it | ||
1743 | SendKillObject(localID); | ||
1742 | continue; | 1744 | continue; |
1745 | } | ||
1743 | 1746 | ||
1744 | // Already deleted by someone else | 1747 | // Already deleted by someone else |
1745 | if (part.ParentGroup == null || part.ParentGroup.IsDeleted) | 1748 | if (part.ParentGroup == null || part.ParentGroup.IsDeleted) |
1749 | { | ||
1750 | //Client still thinks the object exists, kill it | ||
1751 | SendKillObject(localID); | ||
1746 | continue; | 1752 | continue; |
1753 | } | ||
1747 | 1754 | ||
1748 | // Can't delete child prims | 1755 | // Can't delete child prims |
1749 | if (part != part.ParentGroup.RootPart) | 1756 | if (part != part.ParentGroup.RootPart) |
@@ -1765,15 +1772,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1765 | } | 1772 | } |
1766 | else | 1773 | else |
1767 | { | 1774 | { |
1768 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 1775 | if (action == DeRezAction.TakeCopy) |
1776 | { | ||
1777 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
1778 | permissionToTakeCopy = false; | ||
1779 | } | ||
1780 | else | ||
1781 | { | ||
1769 | permissionToTakeCopy = false; | 1782 | permissionToTakeCopy = false; |
1783 | } | ||
1770 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 1784 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1771 | permissionToTake = false; | 1785 | permissionToTake = false; |
1772 | 1786 | ||
1773 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 1787 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1774 | permissionToDelete = false; | 1788 | permissionToDelete = false; |
1775 | } | 1789 | } |
1776 | |||
1777 | } | 1790 | } |
1778 | 1791 | ||
1779 | // Handle god perms | 1792 | // Handle god perms |