diff options
author | UbitUmarov | 2012-05-16 12:27:49 +0100 |
---|---|---|
committer | UbitUmarov | 2012-05-16 12:27:49 +0100 |
commit | ea47b0362548101d201f3bef26436d3420d791fd (patch) | |
tree | d3485e1923c9918b5e342fb93e2d0c46f5a21296 /OpenSim | |
parent | use part VolumeDetectActive and not rootPart.VolumeDetectActive to be coeren... (diff) | |
download | opensim-SC_OLD-ea47b0362548101d201f3bef26436d3420d791fd.zip opensim-SC_OLD-ea47b0362548101d201f3bef26436d3420d791fd.tar.gz opensim-SC_OLD-ea47b0362548101d201f3bef26436d3420d791fd.tar.bz2 opensim-SC_OLD-ea47b0362548101d201f3bef26436d3420d791fd.tar.xz |
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.
Diffstat (limited to 'OpenSim')
3 files changed, 23 insertions, 6 deletions
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 | |||
1336 | set { m_sitAnimation = value; } | 1336 | set { m_sitAnimation = value; } |
1337 | } | 1337 | } |
1338 | 1338 | ||
1339 | public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); | ||
1340 | |||
1339 | public UUID CollisionSound | 1341 | public UUID CollisionSound |
1340 | { | 1342 | { |
1341 | get { return m_collisionSound; } | 1343 | get { return m_collisionSound; } |
1342 | set | 1344 | set |
1343 | { | 1345 | { |
1344 | m_collisionSound = value; | 1346 | m_collisionSound = value; |
1345 | aggregateScriptEvents(); | 1347 | aggregateScriptEvents(); |
1346 | } | 1348 | } |
@@ -2655,8 +2657,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2655 | 2657 | ||
2656 | bool IsNotVolumeDtc = !VolumeDetectActive; | 2658 | bool IsNotVolumeDtc = !VolumeDetectActive; |
2657 | 2659 | ||
2658 | if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && IsNotVolumeDtc) | 2660 | if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSoundVolume > 0.0f && CollisionSound != invalidCollisionSoundUUID) |
2659 | SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); | 2661 | { |
2662 | if(CollisionSound != UUID.Zero) | ||
2663 | SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); | ||
2664 | else | ||
2665 | { | ||
2666 | // default sounds | ||
2667 | } | ||
2668 | } | ||
2660 | 2669 | ||
2661 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); | 2670 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); |
2662 | if (IsNotVolumeDtc) | 2671 | if (IsNotVolumeDtc) |
@@ -4743,7 +4752,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4743 | 4752 | ||
4744 | pa.OnCollisionUpdate -= PhysicsCollision; | 4753 | pa.OnCollisionUpdate -= PhysicsCollision; |
4745 | 4754 | ||
4746 | bool hassound = ( CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f); | 4755 | bool hassound = ( CollisionSound != invalidCollisionSoundUUID); |
4747 | scriptEvents CombinedEvents = AggregateScriptEvents; | 4756 | scriptEvents CombinedEvents = AggregateScriptEvents; |
4748 | 4757 | ||
4749 | // merge with root part | 4758 | // 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 | |||
4779 | public void llCollisionSound(string impact_sound, double impact_volume) | 4779 | public void llCollisionSound(string impact_sound, double impact_volume) |
4780 | { | 4780 | { |
4781 | m_host.AddScriptLPS(1); | 4781 | m_host.AddScriptLPS(1); |
4782 | 4782 | ||
4783 | if(impact_sound == "") | ||
4784 | { | ||
4785 | m_host.CollisionSoundVolume = (float)impact_volume; | ||
4786 | m_host.CollisionSound = m_host.invalidCollisionSoundUUID; | ||
4787 | return; | ||
4788 | } | ||
4783 | // TODO: Parameter check logic required. | 4789 | // TODO: Parameter check logic required. |
4784 | UUID soundId = UUID.Zero; | 4790 | UUID soundId = UUID.Zero; |
4785 | if (!UUID.TryParse(impact_sound, out soundId)) | 4791 | if (!UUID.TryParse(impact_sound, out soundId)) |
@@ -4795,8 +4801,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4795 | } | 4801 | } |
4796 | m_host.TaskInventory.LockItemsForRead(false); | 4802 | m_host.TaskInventory.LockItemsForRead(false); |
4797 | } | 4803 | } |
4798 | m_host.CollisionSound = soundId; | ||
4799 | m_host.CollisionSoundVolume = (float)impact_volume; | 4804 | m_host.CollisionSoundVolume = (float)impact_volume; |
4805 | m_host.CollisionSound = soundId; | ||
4800 | } | 4806 | } |
4801 | 4807 | ||
4802 | public LSL_String llGetAnimation(string id) | 4808 | 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 | |||
847 | SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); | 847 | SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); |
848 | part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; | 848 | part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; |
849 | part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; | 849 | part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; |
850 | part.CollisionSound = UUID.Zero; | ||
850 | AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); | 851 | AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); |
851 | EventQueue.Clear(); | 852 | EventQueue.Clear(); |
852 | m_Script.ResetVars(); | 853 | m_Script.ResetVars(); |
@@ -873,6 +874,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
873 | SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); | 874 | SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); |
874 | part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; | 875 | part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; |
875 | part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; | 876 | part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; |
877 | part.CollisionSound = UUID.Zero; | ||
876 | AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); | 878 | AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); |
877 | 879 | ||
878 | EventQueue.Clear(); | 880 | EventQueue.Clear(); |