From ea47b0362548101d201f3bef26436d3420d791fd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 16 May 2012 12:27:49 +0100 Subject: Added a invalidCollisionSoundUUID so that scripts can stop all collision sounds with llCollisionSound("",...). UUID.Zero means defaults should be used. In case part has several scripts with confliting llCollisionSound result depende on exec order. Specially on reset the efect of "" depends on reset order, it should override the others. This is intermediate improve(?) since collisions sounds seem to need a deaper revision. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 +++++++++++++---- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 ++++++++-- .../ScriptEngine/Shared/Instance/ScriptInstance.cs | 2 ++ 3 files changed, 23 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8716e20..2fb42f4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1336,11 +1336,13 @@ namespace OpenSim.Region.Framework.Scenes set { m_sitAnimation = value; } } + public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); + public UUID CollisionSound { get { return m_collisionSound; } set - { + { m_collisionSound = value; aggregateScriptEvents(); } @@ -2655,8 +2657,15 @@ namespace OpenSim.Region.Framework.Scenes bool IsNotVolumeDtc = !VolumeDetectActive; - if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && IsNotVolumeDtc) - SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); + if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSoundVolume > 0.0f && CollisionSound != invalidCollisionSoundUUID) + { + if(CollisionSound != UUID.Zero) + SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); + else + { + // default sounds + } + } SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); if (IsNotVolumeDtc) @@ -4743,7 +4752,7 @@ namespace OpenSim.Region.Framework.Scenes pa.OnCollisionUpdate -= PhysicsCollision; - bool hassound = ( CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f); + bool hassound = ( CollisionSound != invalidCollisionSoundUUID); scriptEvents CombinedEvents = AggregateScriptEvents; // merge with root part diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e18d9cf..eb68038 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4779,7 +4779,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llCollisionSound(string impact_sound, double impact_volume) { m_host.AddScriptLPS(1); - + + if(impact_sound == "") + { + m_host.CollisionSoundVolume = (float)impact_volume; + m_host.CollisionSound = m_host.invalidCollisionSoundUUID; + return; + } // TODO: Parameter check logic required. UUID soundId = UUID.Zero; if (!UUID.TryParse(impact_sound, out soundId)) @@ -4795,8 +4801,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } m_host.TaskInventory.LockItemsForRead(false); } - m_host.CollisionSound = soundId; m_host.CollisionSoundVolume = (float)impact_volume; + m_host.CollisionSound = soundId; } public LSL_String llGetAnimation(string id) diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index ff1f277..5e68d69 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -847,6 +847,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; + part.CollisionSound = UUID.Zero; AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); EventQueue.Clear(); m_Script.ResetVars(); @@ -873,6 +874,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; + part.CollisionSound = UUID.Zero; AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); EventQueue.Clear(); -- cgit v1.1