From 17f9f1c247679363321b73ec75aed890eaf1b778 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 30 Jul 2014 16:32:25 +0100 Subject: [PATCH] restrict other avatar sounds to parcel flags ( untested ) --- .../CoreModules/World/Sound/SoundModule.cs | 53 ++++++++++++------- .../Region/Framework/Scenes/ScenePresence.cs | 4 +- 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index b43380c23e..9c99c19255 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -139,14 +139,25 @@ namespace OpenSim.Region.CoreModules.World.Sound if (part.SoundQueueing) flags |= (byte)SoundFlags.QUEUE; + if (grp.IsAttachment) + { + ScenePresence ssp = null; + if (!m_scene.TryGetScenePresence(grp.AttachedAvatar, out ssp)) + return; + + if (!ssp.ParcelAllowThisAvatarSounds) + return; + + if (grp.HasPrivateAttachmentPoint) + { + ssp.ControllingClient.SendPlayAttachedSound(soundID, objectID, + ownerID, (float)gain, flags); + return; + } + } + m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) { - if (grp.IsAttachment) - { - if (grp.HasPrivateAttachmentPoint && sp.ControllingClient.AgentId != grp.OwnerID) - return; - } -// no radius ? sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); }); @@ -156,20 +167,33 @@ namespace OpenSim.Region.CoreModules.World.Sound 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)) { - ScenePresence sp; - if (!m_scene.TryGetScenePresence(ownerID, out sp)) + if (!m_scene.TryGetScenePresence(ownerID, out ssp)) + return; + if (!ssp.ParcelAllowThisAvatarSounds) return; } else { SceneObjectGroup grp = part.ParentGroup; - if (grp.IsAttachment && grp.HasPrivateAttachmentPoint) + if (grp.IsAttachment) { -// objectID = ownerID; - parentID = ownerID; + if (!m_scene.TryGetScenePresence(grp.AttachedAvatar, out ssp)) + return; + + if (!ssp.ParcelAllowThisAvatarSounds) + return; + + if (grp.HasPrivateAttachmentPoint) + { + ssp.ControllingClient.SendTriggeredSound(soundId, ownerID, + objectID, parentID, handle, position, + (float)gain); + return; + } } } @@ -242,13 +266,6 @@ namespace OpenSim.Region.CoreModules.World.Sound if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) return; -// if (isMaster) -// m_host.ParentGroup.LoopSoundMasterPrim = m_host; - - // sl does not stop previus sound, volume changes don't work (wiki) -// if (m_host.Sound != UUID.Zero) -// StopSound(m_host); - byte iflags = 1; // looping if (isMaster) iflags |= (byte)SoundFlags.SYNC_MASTER; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3c642199e1..6b627be635 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -482,7 +482,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public bool ParcelAllowSounds + public bool ParcelAllowThisAvatarSounds { get { @@ -5064,7 +5064,7 @@ namespace OpenSim.Region.Framework.Scenes else { - bool candoparcelSound = ParcelAllowSounds; + bool candoparcelSound = ParcelAllowThisAvatarSounds; foreach (uint id in coldata.Keys) {