Fix scripted give and interactive give to offline avatars. Both folder and

single items are now supported. Magic Boxes, yeah!
avinationmerge
Melanie Thielker 2010-05-04 00:44:05 +02:00
parent deaa79ca9e
commit c86259c671
2 changed files with 39 additions and 8 deletions

View File

@ -94,6 +94,22 @@ namespace OpenSim.Region.Framework.Scenes
public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
{
InventoryFolderBase folder;
if (item.Folder == UUID.Zero)
{
folder = InventoryService.GetFolderForType(AgentID, (AssetType)item.AssetType);
if (folder == null)
{
folder = InventoryService.GetRootFolder(AgentID);
if (folder == null)
return;
}
item.Folder = folder.ID;
}
if (InventoryService.AddItem(item))
{
int userlevel = 0;

View File

@ -4005,9 +4005,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
}
// check if destination is an avatar
if (World.GetScenePresence(destId) != null)
// check if destination is an object
if (World.GetSceneObjectPart(destId) != null)
{
// destination is an object
World.MoveTaskInventoryItem(destId, m_host, objId);
}
else
{
ScenePresence presence = World.GetScenePresence(destId);
if (presence == null)
{
UserAccount account =
World.UserAccountService.GetUserAccount(
World.RegionInfo.ScopeID,
destId);
if (account == null)
{
llSay(0, "Can't find destination "+destId.ToString());
return;
}
}
// destination is an avatar
InventoryItemBase agentItem =
World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
@ -4037,12 +4058,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
//This delay should only occur when giving inventory to avatars.
ScriptSleep(3000);
}
else
{
// destination is an object
World.MoveTaskInventoryItem(destId, m_host, objId);
}
}
[DebuggerNonUserCode]