change ossl link sound functions to search for sound both on script host and target prims

0.9.1.0-post-fixes
UbitUmarov 2018-11-14 19:02:00 +00:00
parent afb1d6cdd7
commit fad6295398
2 changed files with 43 additions and 23 deletions

View File

@ -93,15 +93,33 @@ namespace OpenSim.Region.Framework.Scenes.Scripting
public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier, AssetType type)
{
UUID key;
if (UUID.TryParse(identifier, out key))
return key;
if (!UUID.TryParse(identifier, out key))
{
TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier);
if (item != null && item.Type == (int)type)
key = item.AssetID;
return item.AssetID;
return UUID.Zero;
}
public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, SceneObjectPart host, string identifier, AssetType type)
{
UUID key;
if (UUID.TryParse(identifier, out key))
return key;
TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier);
if (item != null && item.Type == (int)type)
return item.AssetID;
if (part.LocalId != host.LocalId)
{
item = host.Inventory.GetInventoryItem(identifier);
if (item != null && item.Type == (int)type)
return item.AssetID;
}
return UUID.Zero;
}
}
}

View File

@ -4900,7 +4900,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null)
return;
sop.AdjustSoundGain(volume);
ScriptSleep(100);
}
public void osSetSoundRadius(LSL_Integer linknum, LSL_Float radius)
@ -4909,7 +4908,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SceneObjectPart sop = GetSingleLinkPart(linknum);
if(sop == null)
return;
m_host.SoundRadius = radius;
sop.SoundRadius = radius;
}
public void osPlaySound(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
@ -4923,7 +4922,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null)
return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero)
return;
@ -4942,7 +4941,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null)
return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero)
return;
@ -4953,11 +4952,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
if (m_SoundModule == null)
return;
SceneObjectPart sop = GetSingleLinkPart(linknum);
if(sop == null)
return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero)
return;
@ -4975,7 +4977,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null)
return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero)
return;
@ -4993,7 +4995,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null)
return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero)
return;
@ -5012,7 +5014,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null)
return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero)
return;
@ -5032,7 +5034,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null)
return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero)
return;
@ -5065,7 +5067,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null)
return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero)
return;