From cc5d6f6b7bcf23b698d1d6a98b60d04bc5ecb036 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 9 Jul 2017 00:14:30 +0100 Subject: throttle collision sounds on a SOG. --- OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/CollisionSounds.cs') diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs index e76fef4..f87043e 100644 --- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs @@ -116,16 +116,20 @@ namespace OpenSim.Region.Framework.Scenes public static void PartCollisionSound(SceneObjectPart part, List collidersinfolist) { + if (part.CollisionSoundType < 0) + return; + if (collidersinfolist.Count == 0 || part == null) return; if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0) return; - if (part.ParentGroup == null) + SceneObjectGroup sog = part.ParentGroup; + if (sog == null || sog.IsDeleted || sog.inTransit) return; - if (part.CollisionSoundType < 0) + if(sog.CollisionSoundThrootled(part.CollisionSoundType)) return; float volume = part.CollisionSoundVolume; @@ -189,15 +193,23 @@ namespace OpenSim.Region.Framework.Scenes continue; } - SceneObjectPart otherPart = part.ParentGroup.Scene.GetSceneObjectPart(id); + SceneObjectPart otherPart = sog.Scene.GetSceneObjectPart(id); if (otherPart != null) { - if (otherPart.CollisionSoundType < 0 || otherPart.VolumeDetectActive) + SceneObjectGroup othersog = otherPart.ParentGroup; + if(othersog == null || othersog.IsDeleted || othersog.inTransit) + continue; + + int otherType = otherPart.CollisionSoundType; + if (otherType < 0 || otherPart.VolumeDetectActive) continue; if (!HaveSound) { - if (otherPart.CollisionSoundType == 1) + if(othersog.CollisionSoundThrootled(otherType)) + continue; + + if (otherType == 1) { soundID = otherPart.CollisionSound; volume = otherPart.CollisionSoundVolume; @@ -206,7 +218,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - if (otherPart.CollisionSoundType == 2) + if (otherType == 2) { volume = otherPart.CollisionSoundVolume; if (volume == 0.0f) -- cgit v1.1 From 63e3fc21efa1089bf90ff2aa703128e8955d9aed Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 10 Jul 2017 13:48:28 +0100 Subject: fix the name of a funtion on last commit --- OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/CollisionSounds.cs') diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs index f87043e..63aafcd 100644 --- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs @@ -129,7 +129,7 @@ namespace OpenSim.Region.Framework.Scenes if (sog == null || sog.IsDeleted || sog.inTransit) return; - if(sog.CollisionSoundThrootled(part.CollisionSoundType)) + if(sog.CollisionSoundThrottled(part.CollisionSoundType)) return; float volume = part.CollisionSoundVolume; @@ -206,7 +206,7 @@ namespace OpenSim.Region.Framework.Scenes if (!HaveSound) { - if(othersog.CollisionSoundThrootled(otherType)) + if(othersog.CollisionSoundThrottled(otherType)) continue; if (otherType == 1) -- cgit v1.1