aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2010-05-04 00:44:05 +0200
committerMelanie Thielker2010-05-04 00:44:05 +0200
commitc86259c6710c8ce5c97a7a64bbb96dac35440aec (patch)
tree339180630c20ebc1099b0c22bc1fcdc0b780e87d /OpenSim
parentRefix the fix (diff)
downloadopensim-SC-c86259c6710c8ce5c97a7a64bbb96dac35440aec.zip
opensim-SC-c86259c6710c8ce5c97a7a64bbb96dac35440aec.tar.gz
opensim-SC-c86259c6710c8ce5c97a7a64bbb96dac35440aec.tar.bz2
opensim-SC-c86259c6710c8ce5c97a7a64bbb96dac35440aec.tar.xz
Fix scripted give and interactive give to offline avatars. Both folder and
single items are now supported. Magic Boxes, yeah!
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs31
2 files changed, 39 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 9b838ab..c105560 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;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 228e9b8..d216eff 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4005,9 +4005,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4005 throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); 4005 throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
4006 } 4006 }
4007 4007
4008 // check if destination is an avatar 4008 // check if destination is an object
4009 if (World.GetScenePresence(destId) != null) 4009 if (World.GetSceneObjectPart(destId) != null)
4010 { 4010 {
4011 // destination is an object
4012 World.MoveTaskInventoryItem(destId, m_host, objId);
4013 }
4014 else
4015 {
4016 ScenePresence presence = World.GetScenePresence(destId);
4017
4018 if (presence == null)
4019 {
4020 UserAccount account =
4021 World.UserAccountService.GetUserAccount(
4022 World.RegionInfo.ScopeID,
4023 destId);
4024
4025 if (account == null)
4026 {
4027 llSay(0, "Can't find destination "+destId.ToString());
4028 return;
4029 }
4030 }
4031
4011 // destination is an avatar 4032 // destination is an avatar
4012 InventoryItemBase agentItem = 4033 InventoryItemBase agentItem =
4013 World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId); 4034 World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
@@ -4037,12 +4058,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4037 //This delay should only occur when giving inventory to avatars. 4058 //This delay should only occur when giving inventory to avatars.
4038 ScriptSleep(3000); 4059 ScriptSleep(3000);
4039 } 4060 }
4040 else
4041 {
4042 // destination is an object
4043 World.MoveTaskInventoryItem(destId, m_host, objId);
4044 }
4045
4046 } 4061 }
4047 4062
4048 [DebuggerNonUserCode] 4063 [DebuggerNonUserCode]