diff options
author | UbitUmarov | 2017-07-09 00:14:30 +0100 |
---|---|---|
committer | UbitUmarov | 2017-07-09 00:14:30 +0100 |
commit | cc5d6f6b7bcf23b698d1d6a98b60d04bc5ecb036 (patch) | |
tree | 67beed0666a796ae8b7a02bcb78e438a745e9fb7 /OpenSim/Region/Framework/Scenes | |
parent | bug fix: dynamic testures set to ALL_SIDES, preserve other face data already ... (diff) | |
download | opensim-SC_OLD-cc5d6f6b7bcf23b698d1d6a98b60d04bc5ecb036.zip opensim-SC_OLD-cc5d6f6b7bcf23b698d1d6a98b60d04bc5ecb036.tar.gz opensim-SC_OLD-cc5d6f6b7bcf23b698d1d6a98b60d04bc5ecb036.tar.bz2 opensim-SC_OLD-cc5d6f6b7bcf23b698d1d6a98b60d04bc5ecb036.tar.xz |
throttle collision sounds on a SOG.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 24 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 30 |
2 files changed, 47 insertions, 7 deletions
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 | |||
116 | 116 | ||
117 | public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist) | 117 | public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist) |
118 | { | 118 | { |
119 | if (part.CollisionSoundType < 0) | ||
120 | return; | ||
121 | |||
119 | if (collidersinfolist.Count == 0 || part == null) | 122 | if (collidersinfolist.Count == 0 || part == null) |
120 | return; | 123 | return; |
121 | 124 | ||
122 | if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0) | 125 | if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0) |
123 | return; | 126 | return; |
124 | 127 | ||
125 | if (part.ParentGroup == null) | 128 | SceneObjectGroup sog = part.ParentGroup; |
129 | if (sog == null || sog.IsDeleted || sog.inTransit) | ||
126 | return; | 130 | return; |
127 | 131 | ||
128 | if (part.CollisionSoundType < 0) | 132 | if(sog.CollisionSoundThrootled(part.CollisionSoundType)) |
129 | return; | 133 | return; |
130 | 134 | ||
131 | float volume = part.CollisionSoundVolume; | 135 | float volume = part.CollisionSoundVolume; |
@@ -189,15 +193,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
189 | continue; | 193 | continue; |
190 | } | 194 | } |
191 | 195 | ||
192 | SceneObjectPart otherPart = part.ParentGroup.Scene.GetSceneObjectPart(id); | 196 | SceneObjectPart otherPart = sog.Scene.GetSceneObjectPart(id); |
193 | if (otherPart != null) | 197 | if (otherPart != null) |
194 | { | 198 | { |
195 | if (otherPart.CollisionSoundType < 0 || otherPart.VolumeDetectActive) | 199 | SceneObjectGroup othersog = otherPart.ParentGroup; |
200 | if(othersog == null || othersog.IsDeleted || othersog.inTransit) | ||
201 | continue; | ||
202 | |||
203 | int otherType = otherPart.CollisionSoundType; | ||
204 | if (otherType < 0 || otherPart.VolumeDetectActive) | ||
196 | continue; | 205 | continue; |
197 | 206 | ||
198 | if (!HaveSound) | 207 | if (!HaveSound) |
199 | { | 208 | { |
200 | if (otherPart.CollisionSoundType == 1) | 209 | if(othersog.CollisionSoundThrootled(otherType)) |
210 | continue; | ||
211 | |||
212 | if (otherType == 1) | ||
201 | { | 213 | { |
202 | soundID = otherPart.CollisionSound; | 214 | soundID = otherPart.CollisionSound; |
203 | volume = otherPart.CollisionSoundVolume; | 215 | volume = otherPart.CollisionSoundVolume; |
@@ -206,7 +218,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
206 | } | 218 | } |
207 | else | 219 | else |
208 | { | 220 | { |
209 | if (otherPart.CollisionSoundType == 2) | 221 | if (otherType == 2) |
210 | { | 222 | { |
211 | volume = otherPart.CollisionSoundVolume; | 223 | volume = otherPart.CollisionSoundVolume; |
212 | if (volume == 0.0f) | 224 | if (volume == 0.0f) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index fdfe8ae..bf915e0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1259,6 +1259,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1259 | set { m_LoopSoundSlavePrims = value; } | 1259 | set { m_LoopSoundSlavePrims = value; } |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | private double m_lastCollisionSoundMS; | ||
1263 | |||
1262 | /// <summary> | 1264 | /// <summary> |
1263 | /// The UUID for the region this object is in. | 1265 | /// The UUID for the region this object is in. |
1264 | /// </summary> | 1266 | /// </summary> |
@@ -1336,7 +1338,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1336 | /// </summary> | 1338 | /// </summary> |
1337 | public SceneObjectGroup() | 1339 | public SceneObjectGroup() |
1338 | { | 1340 | { |
1339 | 1341 | m_lastCollisionSoundMS = Util.GetTimeStampMS() + 1000.0; | |
1340 | } | 1342 | } |
1341 | 1343 | ||
1342 | /// <summary> | 1344 | /// <summary> |
@@ -5528,7 +5530,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
5528 | } | 5530 | } |
5529 | } | 5531 | } |
5530 | 5532 | ||
5533 | public bool CollisionSoundThrootled(int collisionSoundType) | ||
5534 | { | ||
5535 | double time = m_lastCollisionSoundMS; | ||
5536 | // m_lastCollisionSoundMS = Util.GetTimeStampMS(); | ||
5537 | // time = m_lastCollisionSoundMS - time; | ||
5538 | double now = Util.GetTimeStampMS(); | ||
5539 | time = now - time; | ||
5540 | switch (collisionSoundType) | ||
5541 | { | ||
5542 | case 0: // default sounds | ||
5543 | case 2: // default sounds with volume set by script | ||
5544 | if(time < 300.0) | ||
5545 | return true; | ||
5546 | break; | ||
5547 | case 1: // selected sound | ||
5548 | if(time < 200.0) | ||
5549 | return true; | ||
5550 | break; | ||
5551 | default: | ||
5552 | break; | ||
5553 | } | ||
5554 | m_lastCollisionSoundMS = now; | ||
5555 | return false; | ||
5556 | } | ||
5557 | |||
5531 | #endregion | 5558 | #endregion |
5532 | } | 5559 | } |
5533 | 5560 | ||
5561 | |||
5534 | } | 5562 | } |