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.

avinationmerge
UbitUmarov 2012-05-16 12:27:49 +01:00
parent 81d7844f51
commit ea47b03625
3 changed files with 23 additions and 6 deletions

View File

@ -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

View File

@ -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)

View File

@ -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();