check for asset

master
Christopher 2020-06-28 13:55:01 +02:00
parent 22b1a38318
commit c8b69f712f
1 changed files with 12 additions and 2 deletions

View File

@ -86,6 +86,17 @@ namespace OpenSim.Modules.TextureFetcher
return false; return false;
} }
private bool isAssetInInventory(SceneObjectPart part, UUID assetID)
{
List<TaskInventoryItem> inventarContend = part.Inventory.GetInventoryItems();
foreach (TaskInventoryItem item in inventarContend)
if (item.AssetID == assetID)
return true;
return false;
}
private void copyTexturesToInventory(SceneObjectPart part) private void copyTexturesToInventory(SceneObjectPart part)
{ {
if (part.ParentGroup.IsAttachment) if (part.ParentGroup.IsAttachment)
@ -123,11 +134,10 @@ namespace OpenSim.Modules.TextureFetcher
} }
//Check if the item is allready in the inventory and then add it. //Check if the item is allready in the inventory and then add it.
List<UUID> inventarContend = part.Inventory.GetInventoryList();
bool updateNeeded = false; bool updateNeeded = false;
foreach (TaskInventoryItem item in inventoryItems) foreach (TaskInventoryItem item in inventoryItems)
{ {
if(!inventarContend.Contains(item.AssetID)) if(!isAssetInInventory(part, item.AssetID))
{ {
updateNeeded = true; updateNeeded = true;
part.Inventory.AddInventoryItem(item, false); part.Inventory.AddInventoryItem(item, false);