aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorSignpostMarv2012-10-16 12:40:21 +0100
committerJustin Clark-Casey (justincc)2012-10-29 23:39:00 +0000
commitc5af16aef82e2bdf2f4d877a231180e00a8893a6 (patch)
tree3be95d8dea8bfcc764eb0cd374ecd88aed2a7ea6 /OpenSim/Region/ScriptEngine/Shared/Api
parentmoving SendSound from SceneObjectPart to ISoundModule (diff)
downloadopensim-SC_OLD-c5af16aef82e2bdf2f4d877a231180e00a8893a6.zip
opensim-SC_OLD-c5af16aef82e2bdf2f4d877a231180e00a8893a6.tar.gz
opensim-SC_OLD-c5af16aef82e2bdf2f4d877a231180e00a8893a6.tar.bz2
opensim-SC_OLD-c5af16aef82e2bdf2f4d877a231180e00a8893a6.tar.xz
shuffling code around so that the interface for ISoundModule.SendSound() specifies a UUID rather than a string
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs44
1 files changed, 40 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index f29be92..869d94e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -333,6 +333,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
333 return key; 333 return key;
334 } 334 }
335 335
336 /// <summary>
337 /// Return the UUID of the asset matching the specified key or name
338 /// and asset type.
339 /// </summary>
340 /// <param name="k"></param>
341 /// <param name="type"></param>
342 /// <returns></returns>
343 protected UUID KeyOrName(string k, AssetType type)
344 {
345 UUID key;
346
347 if (!UUID.TryParse(k, out key))
348 {
349 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
350 if (item != null && item.Type == (int)type)
351 key = item.AssetID;
352 }
353 else
354 {
355 lock (m_host.TaskInventory)
356 {
357 foreach (KeyValuePair<UUID, TaskInventoryItem> item in m_host.TaskInventory)
358 {
359 if (item.Value.Type == (int)type && item.Value.Name == k)
360 {
361 key = item.Value.ItemID;
362 break;
363 }
364 }
365 }
366 }
367
368
369 return key;
370 }
371
336 //These are the implementations of the various ll-functions used by the LSL scripts. 372 //These are the implementations of the various ll-functions used by the LSL scripts.
337 public LSL_Float llSin(double f) 373 public LSL_Float llSin(double f)
338 { 374 {
@@ -2369,7 +2405,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2369 // send the sound, once, to all clients in range 2405 // send the sound, once, to all clients in range
2370 if (m_SoundModule != null) 2406 if (m_SoundModule != null)
2371 { 2407 {
2372 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, false, false); 2408 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, false, false);
2373 } 2409 }
2374 } 2410 }
2375 2411
@@ -2409,7 +2445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2409 // send the sound, once, to all clients in range 2445 // send the sound, once, to all clients in range
2410 if (m_SoundModule != null) 2446 if (m_SoundModule != null)
2411 { 2447 {
2412 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, true, false); 2448 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, true, false);
2413 } 2449 }
2414 } 2450 }
2415 2451
@@ -2419,7 +2455,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2419 // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory. 2455 // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory.
2420 if (m_SoundModule != null) 2456 if (m_SoundModule != null)
2421 { 2457 {
2422 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, 0, false, false); 2458 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, 0, false, false);
2423 } 2459 }
2424 } 2460 }
2425 2461
@@ -5838,7 +5874,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5838 float radius1 = (float)llVecDist(llGetPos(), top_north_east); 5874 float radius1 = (float)llVecDist(llGetPos(), top_north_east);
5839 float radius2 = (float)llVecDist(llGetPos(), bottom_south_west); 5875 float radius2 = (float)llVecDist(llGetPos(), bottom_south_west);
5840 float radius = Math.Abs(radius1 - radius2); 5876 float radius = Math.Abs(radius1 - radius2);
5841 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, radius, false, false); 5877 m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, radius, false, false);
5842 } 5878 }
5843 } 5879 }
5844 5880