From c5af16aef82e2bdf2f4d877a231180e00a8893a6 Mon Sep 17 00:00:00 2001
From: SignpostMarv
Date: Tue, 16 Oct 2012 12:40:21 +0100
Subject: shuffling code around so that the interface for
ISoundModule.SendSound() specifies a UUID rather than a string
---
.../Shared/Api/Implementation/LSL_Api.cs | 44 ++++++++++++++++++++--
1 file changed, 40 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
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
return key;
}
+ ///
+ /// Return the UUID of the asset matching the specified key or name
+ /// and asset type.
+ ///
+ ///
+ ///
+ ///
+ protected UUID KeyOrName(string k, AssetType type)
+ {
+ UUID key;
+
+ if (!UUID.TryParse(k, out key))
+ {
+ TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
+ if (item != null && item.Type == (int)type)
+ key = item.AssetID;
+ }
+ else
+ {
+ lock (m_host.TaskInventory)
+ {
+ foreach (KeyValuePair item in m_host.TaskInventory)
+ {
+ if (item.Value.Type == (int)type && item.Value.Name == k)
+ {
+ key = item.Value.ItemID;
+ break;
+ }
+ }
+ }
+ }
+
+
+ return key;
+ }
+
//These are the implementations of the various ll-functions used by the LSL scripts.
public LSL_Float llSin(double f)
{
@@ -2369,7 +2405,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// send the sound, once, to all clients in range
if (m_SoundModule != null)
{
- m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, false, false);
+ m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, false, false);
}
}
@@ -2409,7 +2445,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// send the sound, once, to all clients in range
if (m_SoundModule != null)
{
- m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, false, 0, 0, true, false);
+ m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, false, 0, 0, true, false);
}
}
@@ -2419,7 +2455,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory.
if (m_SoundModule != null)
{
- m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, 0, false, false);
+ m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, 0, false, false);
}
}
@@ -5838,7 +5874,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
float radius1 = (float)llVecDist(llGetPos(), top_north_east);
float radius2 = (float)llVecDist(llGetPos(), bottom_south_west);
float radius = Math.Abs(radius1 - radius2);
- m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound).ToString(), volume, true, 0, radius, false, false);
+ m_SoundModule.SendSound(m_host.UUID, KeyOrName(sound, AssetType.Sound), volume, true, 0, radius, false, false);
}
}
--
cgit v1.1