diff options
author | Justin Clark-Casey (justincc) | 2012-05-26 01:03:53 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-05-26 01:03:53 +0100 |
commit | d6476b627752c99a6aea5093d080d3633aa6dde8 (patch) | |
tree | 7bdd8ec1246efc78174a0cb279e4632c708dd9f6 /OpenSim/Region/ScriptEngine/Shared | |
parent | Use SceneObjectPartInventory.GetInventoryItem() in OSSL.AvatarStopAnimation i... (diff) | |
download | opensim-SC_OLD-d6476b627752c99a6aea5093d080d3633aa6dde8.zip opensim-SC_OLD-d6476b627752c99a6aea5093d080d3633aa6dde8.tar.gz opensim-SC_OLD-d6476b627752c99a6aea5093d080d3633aa6dde8.tar.bz2 opensim-SC_OLD-d6476b627752c99a6aea5093d080d3633aa6dde8.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9908a39..6438bcc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -284,23 +284,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
284 | 284 | ||
285 | protected UUID InventoryKey(string name, int type) | 285 | protected UUID InventoryKey(string name, int type) |
286 | { | 286 | { |
287 | m_host.AddScriptLPS(1); | 287 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); |
288 | 288 | ||
289 | lock (m_host.TaskInventory) | 289 | if (item != null && item.Type == type) |
290 | { | 290 | return item.AssetID; |
291 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | 291 | else |
292 | { | 292 | return UUID.Zero; |
293 | if (inv.Value.Name == name) | ||
294 | { | ||
295 | if (inv.Value.Type != type) | ||
296 | return UUID.Zero; | ||
297 | |||
298 | return inv.Value.AssetID; | ||
299 | } | ||
300 | } | ||
301 | } | ||
302 | |||
303 | return UUID.Zero; | ||
304 | } | 293 | } |
305 | 294 | ||
306 | /// <summary> | 295 | /// <summary> |
@@ -1707,14 +1696,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1707 | 1696 | ||
1708 | return rgb; | 1697 | return rgb; |
1709 | } | 1698 | } |
1699 | |||
1710 | if (face >= 0 && face < GetNumberOfSides(part)) | 1700 | if (face >= 0 && face < GetNumberOfSides(part)) |
1711 | { | 1701 | { |
1712 | texcolor = tex.GetFace((uint)face).RGBA; | 1702 | texcolor = tex.GetFace((uint)face).RGBA; |
1713 | rgb.x = texcolor.R; | 1703 | rgb.x = texcolor.R; |
1714 | rgb.y = texcolor.G; | 1704 | rgb.y = texcolor.G; |
1715 | rgb.z = texcolor.B; | 1705 | rgb.z = texcolor.B; |
1706 | |||
1716 | return rgb; | 1707 | return rgb; |
1717 | |||
1718 | } | 1708 | } |
1719 | else | 1709 | else |
1720 | { | 1710 | { |