diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f9da341..0ac427f 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 | { |
@@ -836,8 +851,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
836 | public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) | 851 | public void RemoveTaskInventory(IClientAPI remoteClient, UUID itemID, uint localID) |
837 | { | 852 | { |
838 | SceneObjectPart part = GetSceneObjectPart(localID); | 853 | SceneObjectPart part = GetSceneObjectPart(localID); |
839 | SceneObjectGroup group = part.ParentGroup; | 854 | SceneObjectGroup group = null; |
840 | if (group != null) | 855 | if (part != null) |
856 | { | ||
857 | group = part.ParentGroup; | ||
858 | } | ||
859 | if (part != null && group != null) | ||
841 | { | 860 | { |
842 | TaskInventoryItem item = group.GetInventoryItem(localID, itemID); | 861 | TaskInventoryItem item = group.GetInventoryItem(localID, itemID); |
843 | if (item == null) | 862 | if (item == null) |
@@ -1266,7 +1285,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1266 | } | 1285 | } |
1267 | if (part.Inventory.UpdateInventoryItem(itemInfo)) | 1286 | if (part.Inventory.UpdateInventoryItem(itemInfo)) |
1268 | { | 1287 | { |
1269 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | 1288 | // remoteClient.SendAgentAlertMessage("Notecard saved", false); |
1270 | part.GetProperties(remoteClient); | 1289 | part.GetProperties(remoteClient); |
1271 | } | 1290 | } |
1272 | } | 1291 | } |
@@ -1359,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1359 | return; | 1378 | return; |
1360 | 1379 | ||
1361 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, | 1380 | AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, |
1362 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"), | 1381 | Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n\n touch_start(integer num)\n {\n }\n}"), |
1363 | remoteClient.AgentId); | 1382 | remoteClient.AgentId); |
1364 | AssetService.Store(asset); | 1383 | AssetService.Store(asset); |
1365 | 1384 | ||
@@ -1593,11 +1612,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1593 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) | 1612 | if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) |
1594 | permissionToDelete = false; | 1613 | permissionToDelete = false; |
1595 | } | 1614 | } |
1596 | |||
1597 | } | 1615 | } |
1598 | 1616 | ||
1599 | // Handle god perms | 1617 | // Handle god perms |
1600 | if (Permissions.IsGod(remoteClient.AgentId)) | 1618 | if (remoteClient != null && Permissions.IsGod(remoteClient.AgentId)) |
1601 | { | 1619 | { |
1602 | permissionToTake = true; | 1620 | permissionToTake = true; |
1603 | permissionToTakeCopy = true; | 1621 | permissionToTakeCopy = true; |