diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 52 |
1 files changed, 15 insertions, 37 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4b28808..9908a39 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -104,9 +104,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
104 | protected int m_scriptConsoleChannel = 0; | 104 | protected int m_scriptConsoleChannel = 0; |
105 | protected bool m_scriptConsoleChannelEnabled = false; | 105 | protected bool m_scriptConsoleChannelEnabled = false; |
106 | protected IUrlModule m_UrlModule = null; | 106 | protected IUrlModule m_UrlModule = null; |
107 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = | 107 | protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = new Dictionary<UUID, UserInfoCacheEntry>(); |
108 | new Dictionary<UUID, UserInfoCacheEntry>(); | 108 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. |
109 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. | ||
110 | 109 | ||
111 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 110 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
112 | { | 111 | { |
@@ -304,25 +303,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
304 | return UUID.Zero; | 303 | return UUID.Zero; |
305 | } | 304 | } |
306 | 305 | ||
307 | protected UUID InventoryKey(string name) | ||
308 | { | ||
309 | m_host.AddScriptLPS(1); | ||
310 | |||
311 | lock (m_host.TaskInventory) | ||
312 | { | ||
313 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) | ||
314 | { | ||
315 | if (inv.Value.Name == name) | ||
316 | { | ||
317 | return inv.Value.AssetID; | ||
318 | } | ||
319 | } | ||
320 | } | ||
321 | |||
322 | return UUID.Zero; | ||
323 | } | ||
324 | |||
325 | |||
326 | /// <summary> | 306 | /// <summary> |
327 | /// accepts a valid UUID, -or- a name of an inventory item. | 307 | /// accepts a valid UUID, -or- a name of an inventory item. |
328 | /// Returns a valid UUID or UUID.Zero if key invalid and item not found | 308 | /// Returns a valid UUID or UUID.Zero if key invalid and item not found |
@@ -332,19 +312,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
332 | /// <returns></returns> | 312 | /// <returns></returns> |
333 | protected UUID KeyOrName(string k) | 313 | protected UUID KeyOrName(string k) |
334 | { | 314 | { |
335 | UUID key = UUID.Zero; | 315 | UUID key; |
336 | 316 | ||
337 | // if we can parse the string as a key, use it. | 317 | // if we can parse the string as a key, use it. |
338 | if (UUID.TryParse(k, out key)) | ||
339 | { | ||
340 | return key; | ||
341 | } | ||
342 | // else try to locate the name in inventory of object. found returns key, | 318 | // else try to locate the name in inventory of object. found returns key, |
343 | // not found returns UUID.Zero which will translate to the default particle texture | 319 | // not found returns UUID.Zero |
344 | else | 320 | if (!UUID.TryParse(k, out key)) |
345 | { | 321 | { |
346 | return InventoryKey(k); | 322 | TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k); |
323 | |||
324 | if (item != null) | ||
325 | key = item.AssetID; | ||
326 | else | ||
327 | key = UUID.Zero; | ||
347 | } | 328 | } |
329 | |||
330 | return key; | ||
348 | } | 331 | } |
349 | 332 | ||
350 | // convert a LSL_Rotation to a Quaternion | 333 | // convert a LSL_Rotation to a Quaternion |
@@ -3315,17 +3298,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3315 | 3298 | ||
3316 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) | 3299 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) |
3317 | { | 3300 | { |
3318 | UUID animID = new UUID(); | ||
3319 | |||
3320 | if (!UUID.TryParse(anim, out animID)) | ||
3321 | { | ||
3322 | animID = InventoryKey(anim); | ||
3323 | } | ||
3324 | |||
3325 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); | 3301 | ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); |
3326 | 3302 | ||
3327 | if (presence != null) | 3303 | if (presence != null) |
3328 | { | 3304 | { |
3305 | UUID animID = KeyOrName(anim); | ||
3306 | |||
3329 | if (animID == UUID.Zero) | 3307 | if (animID == UUID.Zero) |
3330 | presence.Animator.RemoveAnimation(anim); | 3308 | presence.Animator.RemoveAnimation(anim); |
3331 | else | 3309 | else |