mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 03:15:41 +08:00
add llLinkAdjustSoundVolume, llLinkPlaySound and llLinkStopSound
This commit is contained in:
@@ -798,41 +798,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
switch (linkType)
|
||||
{
|
||||
case ScriptBaseClass.LINK_SET:
|
||||
return new List<SceneObjectPart>(part.ParentGroup.Parts);
|
||||
case ScriptBaseClass.LINK_SET:
|
||||
return new List<SceneObjectPart>(part.ParentGroup.Parts);
|
||||
|
||||
case ScriptBaseClass.LINK_ROOT:
|
||||
ret.Add(part.ParentGroup.RootPart);
|
||||
return ret;
|
||||
|
||||
case ScriptBaseClass.LINK_ALL_OTHERS:
|
||||
ret = new List<SceneObjectPart>(part.ParentGroup.Parts);
|
||||
|
||||
if (ret.Contains(part))
|
||||
ret.Remove(part);
|
||||
|
||||
return ret;
|
||||
|
||||
case ScriptBaseClass.LINK_ALL_CHILDREN:
|
||||
ret = new List<SceneObjectPart>(part.ParentGroup.Parts);
|
||||
|
||||
if (ret.Contains(part.ParentGroup.RootPart))
|
||||
ret.Remove(part.ParentGroup.RootPart);
|
||||
return ret;
|
||||
|
||||
case ScriptBaseClass.LINK_THIS:
|
||||
ret.Add(part);
|
||||
return ret;
|
||||
|
||||
default:
|
||||
if (linkType < 0)
|
||||
case ScriptBaseClass.LINK_ROOT:
|
||||
ret.Add(part.ParentGroup.RootPart);
|
||||
return ret;
|
||||
|
||||
SceneObjectPart target = part.ParentGroup.GetLinkNumPart(linkType);
|
||||
if (target == null)
|
||||
case ScriptBaseClass.LINK_ALL_OTHERS:
|
||||
ret = new List<SceneObjectPart>(part.ParentGroup.Parts);
|
||||
|
||||
if (ret.Contains(part))
|
||||
ret.Remove(part);
|
||||
|
||||
return ret;
|
||||
|
||||
case ScriptBaseClass.LINK_ALL_CHILDREN:
|
||||
ret = new List<SceneObjectPart>(part.ParentGroup.Parts);
|
||||
|
||||
if (ret.Contains(part.ParentGroup.RootPart))
|
||||
ret.Remove(part.ParentGroup.RootPart);
|
||||
return ret;
|
||||
|
||||
case ScriptBaseClass.LINK_THIS:
|
||||
ret.Add(part);
|
||||
return ret;
|
||||
|
||||
default:
|
||||
if (linkType < 0)
|
||||
return ret;
|
||||
|
||||
SceneObjectPart target = part.ParentGroup.GetLinkNumPart(linkType);
|
||||
if (target == null)
|
||||
return ret;
|
||||
ret.Add(target);
|
||||
return ret;
|
||||
ret.Add(target);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3156,6 +3156,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_SoundModule.SendSound(m_host.UUID, soundID, volume, false, 0, false, false);
|
||||
}
|
||||
|
||||
public void llLinkPlaySound(LSL_Integer linknumber, string sound, double volume)
|
||||
{
|
||||
if (m_SoundModule == null)
|
||||
return;
|
||||
if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
|
||||
return;
|
||||
|
||||
SceneObjectPart sop;
|
||||
if (linknumber = ScriptBaseClass.LINK_THIS)
|
||||
sop = m_host;
|
||||
else if (linknumber < 0)
|
||||
return;
|
||||
else if (linknumber < 2)
|
||||
sop = m_host.ParentGroup.RootPart;
|
||||
else
|
||||
sop = m_host.ParentGroup.GetLinkNumPart(linknumber);
|
||||
|
||||
if(sop == null)
|
||||
return;
|
||||
|
||||
UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound, AssetType.Sound);
|
||||
if (soundID.IsZero())
|
||||
return;
|
||||
|
||||
// send the sound, once, to all clients in range
|
||||
m_SoundModule.SendSound(sop.UUID, soundID, volume, false, 0, false, false);
|
||||
}
|
||||
|
||||
public void llLoopSound(string sound, double volume)
|
||||
{
|
||||
|
||||
@@ -3230,6 +3258,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
m_SoundModule.StopSound(m_host.UUID);
|
||||
}
|
||||
|
||||
public void llLinkStopSound(LSL_Integer linknumber)
|
||||
{
|
||||
if (m_SoundModule != null)
|
||||
{
|
||||
foreach(SceneObjectPart sop in GetLinkParts(linknumber))
|
||||
m_SoundModule.StopSound(sop.UUID);
|
||||
}
|
||||
}
|
||||
|
||||
public void llPreloadSound(string sound)
|
||||
{
|
||||
|
||||
@@ -6706,6 +6743,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
ScriptSleep(m_sleepMsOnAdjustSoundVolume);
|
||||
}
|
||||
|
||||
public void llLinkAdjustSoundVolume(LSL_Integer linknumber, LSL_Float volume)
|
||||
{
|
||||
List<SceneObjectPart> parts = GetLinkParts(linknumber);
|
||||
foreach (SceneObjectPart part in parts)
|
||||
{
|
||||
part.AdjustSoundGain(volume);
|
||||
}
|
||||
ScriptSleep(m_sleepMsOnAdjustSoundVolume);
|
||||
}
|
||||
|
||||
public void llSetSoundRadius(double radius)
|
||||
{
|
||||
m_host.SoundRadius = radius;
|
||||
|
||||
@@ -488,5 +488,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
LSL_Integer llHash(LSL_String s);
|
||||
|
||||
LSL_String llReplaceSubString(LSL_String src, LSL_String pattern, LSL_String replacement, int count);
|
||||
|
||||
void llLinkAdjustSoundVolume(LSL_Integer linknumber, LSL_Float volume);
|
||||
void llLinkStopSound(LSL_Integer linknumber);
|
||||
void llLinkPlaySound(LSL_Integer linknumber, string sound, double volume);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2217,5 +2217,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
{
|
||||
return m_LSL_Functions.llReplaceSubString(src, pattern, replacement, count);
|
||||
}
|
||||
|
||||
public void llLinkAdjustSoundVolume(LSL_Integer linknumber, LSL_Float volume)
|
||||
{
|
||||
m_LSL_Functions.llLinkAdjustSoundVolume(linknumber, volume);
|
||||
}
|
||||
|
||||
public void llLinkStopSound(LSL_Integer linknumber)
|
||||
{
|
||||
m_LSL_Functions.llLinkStopSound(linknumber);
|
||||
}
|
||||
|
||||
public void llLinkPlaySound(LSL_Integer linknumber, string sound, double volume)
|
||||
{
|
||||
m_LSL_Functions.llLinkPlaySound(linknumber, sound, volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user