aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs45
1 files changed, 40 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index a1f434e..221a32b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -188,6 +188,7 @@ namespace OpenSim.Region.Framework.Scenes
188 188
189 public double SoundRadius; 189 public double SoundRadius;
190 190
191
191 public uint TimeStampFull; 192 public uint TimeStampFull;
192 193
193 public uint TimeStampLastActivity; // Will be used for AutoReturn 194 public uint TimeStampLastActivity; // Will be used for AutoReturn
@@ -332,6 +333,8 @@ namespace OpenSim.Region.Framework.Scenes
332 private UUID m_collisionSound; 333 private UUID m_collisionSound;
333 private float m_collisionSoundVolume; 334 private float m_collisionSoundVolume;
334 335
336 private DateTime LastColSoundSentTime;
337
335 338
336 private SOPVehicle m_vehicle = null; 339 private SOPVehicle m_vehicle = null;
337 340
@@ -371,6 +374,7 @@ namespace OpenSim.Region.Framework.Scenes
371 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from 374 // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
372 // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log 375 // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log
373 m_inventory = new SceneObjectPartInventory(this); 376 m_inventory = new SceneObjectPartInventory(this);
377 LastColSoundSentTime = DateTime.UtcNow;
374 } 378 }
375 379
376 /// <summary> 380 /// <summary>
@@ -1347,11 +1351,13 @@ namespace OpenSim.Region.Framework.Scenes
1347 set { m_sitAnimation = value; } 1351 set { m_sitAnimation = value; }
1348 } 1352 }
1349 1353
1354 public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff");
1355
1350 public UUID CollisionSound 1356 public UUID CollisionSound
1351 { 1357 {
1352 get { return m_collisionSound; } 1358 get { return m_collisionSound; }
1353 set 1359 set
1354 { 1360 {
1355 m_collisionSound = value; 1361 m_collisionSound = value;
1356 aggregateScriptEvents(); 1362 aggregateScriptEvents();
1357 } 1363 }
@@ -2640,7 +2646,6 @@ namespace OpenSim.Region.Framework.Scenes
2640 2646
2641 else 2647 else
2642 { 2648 {
2643
2644 // calculate things that started colliding this time 2649 // calculate things that started colliding this time
2645 // and build up list of colliders this time 2650 // and build up list of colliders this time
2646 foreach (uint localid in collissionswith.Keys) 2651 foreach (uint localid in collissionswith.Keys)
@@ -2665,12 +2670,13 @@ namespace OpenSim.Region.Framework.Scenes
2665 foreach (uint localID in endedColliders) 2670 foreach (uint localID in endedColliders)
2666 m_lastColliders.Remove(localID); 2671 m_lastColliders.Remove(localID);
2667 } 2672 }
2673
2668 // play the sound. 2674 // play the sound.
2669 2675
2670 bool IsNotVolumeDtc = !VolumeDetectActive; 2676 bool IsNotVolumeDtc = !VolumeDetectActive;
2671 2677
2672 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && IsNotVolumeDtc) 2678 if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSound != invalidCollisionSoundUUID)
2673 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); 2679 CollisionSounds.PartCollisionSound(this, startedColliders);
2674 2680
2675 SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); 2681 SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart);
2676 if (IsNotVolumeDtc) 2682 if (IsNotVolumeDtc)
@@ -3204,6 +3210,35 @@ namespace OpenSim.Region.Framework.Scenes
3204 } 3210 }
3205 } 3211 }
3206 3212
3213 public void SendCollisionSound(UUID soundID, double volume, Vector3 position)
3214 {
3215 if (soundID == UUID.Zero)
3216 return;
3217
3218 ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
3219 if (soundModule == null)
3220 return;
3221
3222 if (volume > 1)
3223 volume = 1;
3224 if (volume < 0)
3225 volume = 0;
3226
3227 DateTime now = DateTime.UtcNow;
3228 if((now - LastColSoundSentTime).Milliseconds < 200) // reduce rate to 5 per sec per part ??
3229 return;
3230
3231 LastColSoundSentTime = now;
3232
3233 UUID ownerID = OwnerID;
3234 UUID objectID = ParentGroup.RootPart.UUID;
3235 UUID parentID = ParentGroup.UUID;
3236 ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
3237
3238 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 );
3239 }
3240
3241
3207 /// <summary> 3242 /// <summary>
3208 /// Send a terse update to all clients 3243 /// Send a terse update to all clients
3209 /// </summary> 3244 /// </summary>
@@ -4757,7 +4792,7 @@ namespace OpenSim.Region.Framework.Scenes
4757 4792
4758 pa.OnCollisionUpdate -= PhysicsCollision; 4793 pa.OnCollisionUpdate -= PhysicsCollision;
4759 4794
4760 bool hassound = ( CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f); 4795 bool hassound = ( CollisionSound != invalidCollisionSoundUUID);
4761 scriptEvents CombinedEvents = AggregateScriptEvents; 4796 scriptEvents CombinedEvents = AggregateScriptEvents;
4762 4797
4763 // merge with root part 4798 // merge with root part