diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6e73fe9..c77efc7 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 | TaskInventoryItem item = group.GetInventoryItem(localID, itemID); | 938 | TaskInventoryItem item = group.GetInventoryItem(localID, itemID); |
920 | if (item == null) | 939 | if (item == null) |
@@ -1442,7 +1461,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1442 | return; | 1461 | return; |
1443 | 1462 | ||
1444 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1463 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1445 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1464 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1446 | remoteClient.AgentId); | 1465 | remoteClient.AgentId); |
1447 | AssetService.Store(asset); | 1466 | AssetService.Store(asset); |
1448 | 1467 | ||
@@ -1668,15 +1687,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1668 | } | 1687 | } |
1669 | else | 1688 | else |
1670 | { | 1689 | { |
1671 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | 1690 | if (action == DeRezAction.TakeCopy) |
1691 | { | ||
1692 | if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) | ||
1693 | permissionToTakeCopy = false; | ||
1694 | } | ||
1695 | else | ||
1696 | { | ||
1672 | permissionToTakeCopy = false; | 1697 | permissionToTakeCopy = false; |
1698 | } | ||
1673 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) | 1699 | if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) |
1674 | permissionToTake = false; | 1700 | permissionToTake = false; |
1675 | 1701 | ||
1676 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 1702 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1677 | permissionToDelete = false; | 1703 | permissionToDelete = false; |
1678 | } | 1704 | } |
1679 | |||
1680 | } | 1705 | } |
1681 | 1706 | ||
1682 | // Handle god perms | 1707 | // Handle god perms |