Use GetInventoryItem() in LSL_Api.InventoryKey(string name, int type).

Also removes small bug where calling this method would add 1 to LPS, evne though all callers already did this.
0.7.3-extended
Justin Clark-Casey (justincc) 2012-05-26 01:03:53 +01:00
parent 67abbcf269
commit 4d44f2d248
1 changed files with 7 additions and 16 deletions

View File

@ -273,23 +273,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected UUID InventoryKey(string name, int type) protected UUID InventoryKey(string name, int type)
{ {
m_host.AddScriptLPS(1); TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
lock (m_host.TaskInventory) if (item != null && item.Type == type)
{ return item.AssetID;
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) else
{ return UUID.Zero;
if (inv.Value.Name == name)
{
if (inv.Value.Type != type)
return UUID.Zero;
return inv.Value.AssetID;
}
}
}
return UUID.Zero;
} }
/// <summary> /// <summary>
@ -1694,12 +1683,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return rgb; return rgb;
} }
if (face >= 0 && face < GetNumberOfSides(part)) if (face >= 0 && face < GetNumberOfSides(part))
{ {
texcolor = tex.GetFace((uint)face).RGBA; texcolor = tex.GetFace((uint)face).RGBA;
rgb.x = texcolor.R; rgb.x = texcolor.R;
rgb.y = texcolor.G; rgb.y = texcolor.G;
rgb.z = texcolor.B; rgb.z = texcolor.B;
return rgb; return rgb;
} }
else else