From 44c56a974c428379ebf82386aac7b7443fd82a7d Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Wed, 19 Nov 2008 18:30:16 +0000 Subject: Mantis#2656. Thank you kindly, Nlin for a patch that: Attached patch implements llCollisionSound. Thanks T. Sado. --- .../Region/Environment/Scenes/SceneObjectPart.cs | 37 +++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index c7862ec..a626fa3 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -201,6 +201,10 @@ namespace OpenSim.Region.Environment.Scenes private Vector3 m_cameraAtOffset = new Vector3(0.0f, 0.0f, 0.0f); private bool m_forceMouselook = false; + // TODO: Collision sound should have default. + private UUID m_collisionSound = UUID.Zero; + private float m_collisionSoundVolume = 0.0f; + #endregion Fields #region Constructors @@ -952,6 +956,22 @@ if (m_shape != null) { set { m_sitAnimation = value; } } + public UUID CollisionSound + { + get { return m_collisionSound; } + set + { + m_collisionSound = value; + aggregateScriptEvents(); + } + } + + public float CollisionSoundVolume + { + get { return m_collisionSoundVolume; } + set { m_collisionSoundVolume = value; } + } + #endregion Public Properties with only Get @@ -1607,6 +1627,12 @@ if (m_shape != null) { if (m_parentGroup.IsDeleted) return; + // play the sound. + if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) + { + SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0); + } + if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) { // do event notification @@ -3233,7 +3259,8 @@ if (m_shape != null) { if ( ((AggregateScriptEvents & scriptEvents.collision) != 0) || ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || - ((AggregateScriptEvents & scriptEvents.collision_start) != 0) + ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || + (CollisionSound != null && CollisionSound != UUID.Zero) ) { // subscribe to physics updates. @@ -3252,6 +3279,13 @@ if (m_shape != null) { PhysActor.OnCollisionUpdate -= PhysicsCollision; } } + + if (m_parentGroup == null) + { + ScheduleFullUpdate(); + return; + } + if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) { m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; @@ -3363,3 +3397,4 @@ if (m_shape != null) { + -- cgit v1.1