Fix playing sound from HUDs

avinationmerge
Melanie 2010-11-03 23:20:30 +01:00
parent 5f8ab9f018
commit c2bd6ccdb8
2 changed files with 16 additions and 10 deletions

View File

@ -31,12 +31,14 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using System.Reflection;
using log4net;
namespace OpenSim.Region.CoreModules.World.Sound
{
public class SoundModule : IRegionModule, ISoundModule
{
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Scene m_scene;
@ -79,7 +81,6 @@ namespace OpenSim.Region.CoreModules.World.Sound
if (grp.IsAttachment)
{
if (grp.GetAttachmentPoint() > 30) // HUD
{
if (sp.ControllingClient.AgentId != grp.OwnerID)
@ -96,6 +97,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
else
gain = (float)((double)gain * ((radius - dis) / radius));
m_log.DebugFormat("Play sound, gain {0}", gain);
sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
});
}
@ -103,6 +105,18 @@ namespace OpenSim.Region.CoreModules.World.Sound
public virtual void TriggerSound(
UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius)
{
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
if (part == null)
return;
SceneObjectGroup grp = part.ParentGroup;
if (grp.IsAttachment && grp.GetAttachmentPoint() > 30)
{
objectID = ownerID;
parentID = ownerID;
}
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
{
if (sp.IsChildAgent)

View File

@ -3115,14 +3115,6 @@ namespace OpenSim.Region.Framework.Scenes
UUID objectID = ParentGroup.RootPart.UUID;
UUID parentID = GetRootPartUUID();
if (ParentGroup.IsAttachment && ParentGroup.RootPart.Shape.State > 30)
{
// Use the avatar as the parent for HUDs, since the prims
// are not sent to other avatars
objectID = _ownerID;
parentID = _ownerID;
}
UUID soundID = UUID.Zero;
Vector3 position = AbsolutePosition; // region local
ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle;