diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 01edf51..59731f7 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 | { |
@@ -913,8 +928,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
913 | public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) | 928 | public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) |
914 | { | 929 | { |
915 | SceneObjectPart part = GetSceneObjectPart(localID); | 930 | SceneObjectPart part = GetSceneObjectPart(localID); |
916 | SceneObjectGroup group = part.ParentGroup; | 931 | SceneObjectGroup group = null; |
917 | if (group != null) | 932 | if (part != null) |
933 | { | ||
934 | group = part.ParentGroup; | ||
935 | } | ||
936 | if (part != null && group != null) | ||
918 | { | 937 | { |
919 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) | 938 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) |
920 | return; | 939 | return; |
@@ -1489,7 +1508,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1489 | return; | 1508 | return; |
1490 | 1509 | ||
1491 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1510 | 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}"), | 1511 | 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); | 1512 | remoteClient.AgentId); |
1494 | AssetService.Store(asset); | 1513 | AssetService.Store(asset); |
1495 | 1514 | ||
@@ -1684,11 +1703,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1684 | // Invalid id | 1703 | // Invalid id |
1685 | SceneObjectPart part = GetSceneObjectPart(localID); | 1704 | SceneObjectPart part = GetSceneObjectPart(localID); |
1686 | if (part == null) | 1705 | if (part == null) |
1706 | { | ||
1707 | //Client still thinks the object exists, kill it | ||
1708 | SendKillObject(localID); | ||
1687 | continue; | 1709 | continue; |
1710 | } | ||
1688 | 1711 | ||
1689 | // Already deleted by someone else | 1712 | // Already deleted by someone else |
1690 | if (part.ParentGroup == null || part.ParentGroup.IsDeleted) | 1713 | if (part.ParentGroup == null || part.ParentGroup.IsDeleted) |
1714 | { | ||
1715 | //Client still thinks the object exists, kill it | ||
1716 | SendKillObject(localID); | ||
1691 | continue; | 1717 | continue; |
1718 | } | ||
1692 | 1719 | ||
1693 | // Can't delete child prims | 1720 | // Can't delete child prims |
1694 | if (part != part.ParentGroup.RootPart) | 1721 | if (part != part.ParentGroup.RootPart) |
@@ -1715,15 +1742,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1715 | } | 1742 | } |
1716 | else | 1743 | else |
1717 | { | 1744 | { |
1718 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 1745 | if (action == DeRezAction.TakeCopy) |
1746 | { | ||
1747 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
1748 | permissionToTakeCopy = false; | ||
1749 | } | ||
1750 | else | ||
1751 | { | ||
1719 | permissionToTakeCopy = false; | 1752 | permissionToTakeCopy = false; |
1753 | } | ||
1720 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 1754 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1721 | permissionToTake = false; | 1755 | permissionToTake = false; |
1722 | 1756 | ||
1723 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 1757 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1724 | permissionToDelete = false; | 1758 | permissionToDelete = false; |
1725 | } | 1759 | } |
1726 | |||
1727 | } | 1760 | } |
1728 | 1761 | ||
1729 | // Handle god perms | 1762 | // Handle god perms |