Add a parameter to prim inventory update to prevent event firing
parent
31d040dc1e
commit
6928ec0240
|
@ -161,6 +161,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// in this prim's inventory.</param>
|
/// in this prim's inventory.</param>
|
||||||
/// <returns>false if the item did not exist, true if the update occurred successfully</returns>
|
/// <returns>false if the item did not exist, true if the update occurred successfully</returns>
|
||||||
bool UpdateInventoryItem(TaskInventoryItem item);
|
bool UpdateInventoryItem(TaskInventoryItem item);
|
||||||
|
bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove an item from this entity's inventory
|
/// Remove an item from this entity's inventory
|
||||||
|
|
|
@ -609,30 +609,37 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <returns>false if the item did not exist, true if the update occurred successfully</returns>
|
/// <returns>false if the item did not exist, true if the update occurred successfully</returns>
|
||||||
public bool UpdateInventoryItem(TaskInventoryItem item)
|
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))
|
||||||
{
|
{
|
||||||
item.ParentID = m_part.UUID;
|
if (m_items.ContainsKey(item.ItemID))
|
||||||
item.ParentPartID = m_part.UUID;
|
|
||||||
item.Flags = m_items[item.ItemID].Flags;
|
|
||||||
|
|
||||||
// If group permissions have been set on, check that the groupID is up to date in case it has
|
|
||||||
// changed since permissions were last set.
|
|
||||||
if (item.GroupPermissions != (uint)PermissionMask.None)
|
|
||||||
item.GroupID = m_part.GroupID;
|
|
||||||
|
|
||||||
if (item.AssetID == UUID.Zero)
|
|
||||||
{
|
{
|
||||||
item.AssetID = m_items[item.ItemID].AssetID;
|
item.ParentID = m_part.UUID;
|
||||||
}
|
item.ParentPartID = m_part.UUID;
|
||||||
|
item.Flags = m_items[item.ItemID].Flags;
|
||||||
|
|
||||||
|
// If group permissions have been set on, check that the groupID is up to date in case it has
|
||||||
|
// changed since permissions were last set.
|
||||||
|
if (item.GroupPermissions != (uint)PermissionMask.None)
|
||||||
|
item.GroupID = m_part.GroupID;
|
||||||
|
|
||||||
|
if (item.AssetID == UUID.Zero)
|
||||||
|
{
|
||||||
|
item.AssetID = m_items[item.ItemID].AssetID;
|
||||||
|
}
|
||||||
m_items[item.ItemID] = item;
|
m_items[item.ItemID] = item;
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
if (fireScriptEvents)
|
||||||
|
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
HasInventoryChanged = true;
|
HasInventoryChanged = true;
|
||||||
m_part.ParentGroup.HasGroupChanged = true;
|
m_part.ParentGroup.HasGroupChanged = true;
|
||||||
|
m_items.LockItemsForWrite(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -643,9 +650,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
item.ItemID, m_part.Name, m_part.UUID,
|
item.ItemID, m_part.Name, m_part.UUID,
|
||||||
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue