add proper way for viewers to request mute of collision sounds by setting flag 0x80 on agent update Flags (const U8 AU_FLAGS_MUTECOLLISIONS = 0x80;). Their current method of comparing sound UUIDS is just BROKEN, even at SL.

This commit is contained in:
UbitUmarov
2022-05-10 14:14:33 +01:00
parent f1f6c2094e
commit 61085cc25e
5 changed files with 70 additions and 11 deletions

View File

@@ -215,6 +215,58 @@ namespace OpenSim.Region.CoreModules.World.Sound
});
}
public virtual void TriggerCollisionSound(
UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle)
{
float radius;
SceneObjectPart part;
ScenePresence ssp = null;
if (!m_scene.TryGetSceneObjectPart(objectID, out part))
{
if (!m_scene.TryGetScenePresence(ownerID, out ssp))
return;
if (!ssp.ParcelAllowThisAvatarSounds)
return;
radius = MaxDistance;
}
else
{
SceneObjectGroup grp = part.ParentGroup;
if (grp.IsAttachment)
{
if (!m_scene.TryGetScenePresence(grp.AttachedAvatar, out ssp))
return;
if (!ssp.ParcelAllowThisAvatarSounds)
return;
}
radius = (float)part.SoundRadius;
if (radius == 0)
{
radius = MaxDistance;
part.SoundRadius = MaxDistance;
}
}
radius *= radius;
m_scene.ForEachRootScenePresence(delegate (ScenePresence sp)
{
if(sp.MuteCollisions)
return;
if (Vector3.DistanceSquared(sp.AbsolutePosition, position) > radius) // Max audio distance
return;
sp.ControllingClient.SendTriggeredSound(soundId, ownerID,
objectID, parentID, handle, position,
(float)gain);
});
}
public virtual void StopSound(UUID objectID)
{
SceneObjectPart m_host;