llCollisionSound(,value) back to disable all sounds. new osCollisionSound(..). allows defualt sounds with volume

LSLKeyTest
UbitUmarov 2016-08-27 16:38:29 +01:00
parent 38ba839eb3
commit b2386b8d0d
4 changed files with 46 additions and 9 deletions

View File

@ -5108,18 +5108,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.CollisionSoundVolume = (float)impact_volume; m_host.CollisionSoundVolume = (float)impact_volume;
m_host.CollisionSound = m_host.invalidCollisionSoundUUID; m_host.CollisionSound = m_host.invalidCollisionSoundUUID;
if(impact_volume == 0.0) m_host.CollisionSoundType = -1; // disable all sounds
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; return;
} }
// TODO: Parameter check logic required. // TODO: Parameter check logic required.
m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound); UUID soundId = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound);
m_host.CollisionSoundVolume = (float)impact_volume; if(soundId != UUID.Zero)
m_host.CollisionSoundType = 1; {
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) public LSL_String llGetAnimation(string id)

View File

@ -45,6 +45,7 @@ using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Scripting;
using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 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 m_UrlModule.RequestSecureURL(m_ScriptEngine.ScriptModule, m_host, m_item.ItemID, opts).ToString();
return UUID.Zero.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;
}
} }
} }

View File

@ -476,5 +476,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String osRequestURL(LSL_List options); LSL_String osRequestURL(LSL_List options);
LSL_String osRequestSecureURL(LSL_List options); LSL_String osRequestSecureURL(LSL_List options);
void osCollisionSound(string impact_sound, double impact_volume);
} }
} }

View File

@ -1089,5 +1089,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{ {
return m_OSSL_Functions.osRequestSecureURL(options); return m_OSSL_Functions.osRequestSecureURL(options);
} }
public void osCollisionSound(string impact_sound, double impact_volume)
{
osCollisionSound(impact_sound, impact_volume);
}
} }
} }