From b2386b8d0dd2c8579b59476abcf120efd68ac6ce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 Aug 2016 16:38:29 +0100 Subject: llCollisionSound(,value) back to disable all sounds. new osCollisionSound(..). allows defualt sounds with volume --- .../Shared/Api/Implementation/LSL_Api.cs | 20 ++++++++------- .../Shared/Api/Implementation/OSSL_Api.cs | 29 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 ++++ 4 files changed, 46 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f45676e..c046a0c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5108,18 +5108,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.CollisionSoundVolume = (float)impact_volume; m_host.CollisionSound = m_host.invalidCollisionSoundUUID; - if(impact_volume == 0.0) - m_host.CollisionSoundType = -1; // disable all sounds - else if(impact_volume == 1.0f) - m_host.CollisionSoundType = 0; // full return to default sounds - else - m_host.CollisionSoundType = 2; // default sounds with volume + m_host.CollisionSoundType = -1; // disable all sounds return; } + // TODO: Parameter check logic required. - m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound); - m_host.CollisionSoundVolume = (float)impact_volume; - m_host.CollisionSoundType = 1; + UUID soundId = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound); + if(soundId != UUID.Zero) + { + m_host.CollisionSound = soundId; + m_host.CollisionSoundVolume = (float)impact_volume; + m_host.CollisionSoundType = 1; + } + else + m_host.CollisionSoundType = -1; } public LSL_String llGetAnimation(string id) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e525a2e..32405d7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -45,6 +45,7 @@ using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Scenes.Scripting; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; using OpenSim.Region.ScriptEngine.Shared.ScriptBase; @@ -4250,5 +4251,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, opts).ToString(); return UUID.Zero.ToString(); } + + public void osCollisionSound(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; + if(impact_volume == 0.0) + m_host.CollisionSoundType = -1; // disable all sounds + else if(impact_volume == 1.0f) + m_host.CollisionSoundType = 0; // full return to default sounds + else + m_host.CollisionSoundType = 2; // default sounds with volume + return; + } + // TODO: Parameter check logic required. + UUID soundId = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound); + if(soundId != UUID.Zero) + { + m_host.CollisionSound = soundId; + m_host.CollisionSoundVolume = (float)impact_volume; + m_host.CollisionSoundType = 1; + } + else + m_host.CollisionSoundType = -1; + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index c99679e..8851e5f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -476,5 +476,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String osRequestURL(LSL_List options); LSL_String osRequestSecureURL(LSL_List options); + void osCollisionSound(string impact_sound, double impact_volume); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 35eee59..9ef6996 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -1089,5 +1089,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osRequestSecureURL(options); } + + public void osCollisionSound(string impact_sound, double impact_volume) + { + osCollisionSound(impact_sound, impact_volume); + } } } -- cgit v1.1