Fix Mantis #4429: Allow llGiveInventory to work across sim borders.

bulletsim
Melanie 2011-05-23 02:52:28 +01:00
parent dc95e38e42
commit 24c00acedc
1 changed files with 23 additions and 9 deletions

View File

@ -3864,9 +3864,29 @@ 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 = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId); InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
@ -3887,17 +3907,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AbsolutePosition.ToString(), m_host.AbsolutePosition.ToString(),
agentItem.ID, true, m_host.AbsolutePosition, agentItem.ID, true, m_host.AbsolutePosition,
bucket); bucket);
if (m_TransferModule != null) if (m_TransferModule != null)
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
}
else
{
// destination is an object
World.MoveTaskInventoryItem(destId, m_host, objId);
}
ScriptSleep(3000); ScriptSleep(3000);
} }
}
public void llRemoveInventory(string name) public void llRemoveInventory(string name)
{ {