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) public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier, AssetType type)
{ {
UUID key; UUID key;
if (UUID.TryParse(identifier, out key))
return key;
if (!UUID.TryParse(identifier, out key))
{
TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier); TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier);
if (item != null && item.Type == (int)type) 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; 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) if(sop == null)
return; return;
sop.AdjustSoundGain(volume); sop.AdjustSoundGain(volume);
ScriptSleep(100);
} }
public void osSetSoundRadius(LSL_Integer linknum, LSL_Float radius) public void osSetSoundRadius(LSL_Integer linknum, LSL_Float radius)
@ -4909,7 +4908,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SceneObjectPart sop = GetSingleLinkPart(linknum); SceneObjectPart sop = GetSingleLinkPart(linknum);
if(sop == null) if(sop == null)
return; return;
m_host.SoundRadius = radius; sop.SoundRadius = radius;
} }
public void osPlaySound(LSL_Integer linknum, LSL_String sound, LSL_Float volume) 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) if(sop == null)
return; return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero) if (soundID == UUID.Zero)
return; return;
@ -4942,7 +4941,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null) if(sop == null)
return; return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero) if (soundID == UUID.Zero)
return; return;
@ -4953,11 +4952,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_SoundModule == null)
return;
SceneObjectPart sop = GetSingleLinkPart(linknum); SceneObjectPart sop = GetSingleLinkPart(linknum);
if(sop == null) if(sop == null)
return; return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero) if (soundID == UUID.Zero)
return; return;
@ -4975,7 +4977,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null) if(sop == null)
return; return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero) if (soundID == UUID.Zero)
return; return;
@ -4993,7 +4995,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null) if(sop == null)
return; return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero) if (soundID == UUID.Zero)
return; return;
@ -5012,7 +5014,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null) if(sop == null)
return; return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero) if (soundID == UUID.Zero)
return; return;
@ -5032,7 +5034,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null) if(sop == null)
return; return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero) if (soundID == UUID.Zero)
return; return;
@ -5065,7 +5067,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if(sop == null) if(sop == null)
return; return;
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound); UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, m_host, sound, AssetType.Sound);
if (soundID == UUID.Zero) if (soundID == UUID.Zero)
return; return;