Add a parameter to prim inventory update to prevent event firing

slimupdates
Melanie 2010-04-27 00:25:29 +01:00
parent 31d040dc1e
commit 6928ec0240
2 changed files with 25 additions and 17 deletions

View File

@ -161,6 +161,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// in this prim's inventory.</param>
/// <returns>false if the item did not exist, true if the update occurred successfully</returns>
bool UpdateInventoryItem(TaskInventoryItem item);
bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents);
/// <summary>
/// Remove an item from this entity's inventory

View File

@ -609,7 +609,14 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>false if the item did not exist, true if the update occurred successfully</returns>
public bool UpdateInventoryItem(TaskInventoryItem item)
{
lock (m_items)
return UpdateInventoryItem(item, true);
}
public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents)
{
lock(m_items)
{
if (m_items.ContainsKey(item.ItemID))
{
if (m_items.ContainsKey(item.ItemID))
{
@ -626,13 +633,13 @@ namespace OpenSim.Region.Framework.Scenes
{
item.AssetID = m_items[item.ItemID].AssetID;
}
m_items[item.ItemID] = item;
m_inventorySerial++;
if (fireScriptEvents)
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
m_items.LockItemsForWrite(false);
return true;
}
else
@ -643,10 +650,10 @@ namespace OpenSim.Region.Framework.Scenes
item.ItemID, m_part.Name, m_part.UUID,
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
}
}
return false;
}
}
/// <summary>
/// Remove an item from this prim's inventory