Fix scripted give and interactive give to offline avatars. Both folder and
single items are now supported. Magic Boxes, yeah!avinationmerge
parent
deaa79ca9e
commit
c86259c671
|
@ -94,6 +94,22 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
|
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))
|
if (InventoryService.AddItem(item))
|
||||||
{
|
{
|
||||||
int userlevel = 0;
|
int userlevel = 0;
|
||||||
|
|
|
@ -4005,9 +4005,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
|
throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if destination is an avatar
|
// check if destination is an object
|
||||||
if (World.GetScenePresence(destId) != null)
|
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
|
// destination is an avatar
|
||||||
InventoryItemBase agentItem =
|
InventoryItemBase agentItem =
|
||||||
World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
|
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.
|
//This delay should only occur when giving inventory to avatars.
|
||||||
ScriptSleep(3000);
|
ScriptSleep(3000);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// destination is an object
|
|
||||||
World.MoveTaskInventoryItem(destId, m_host, objId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DebuggerNonUserCode]
|
[DebuggerNonUserCode]
|
||||||
|
|
Loading…
Reference in New Issue