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,6 +1336,8 @@ namespace OpenSim.Region.Framework.Scenes
set { m_sitAnimation = value; } set { m_sitAnimation = value; }
} }
public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff");
public UUID CollisionSound public UUID CollisionSound
{ {
get { return m_collisionSound; } get { return m_collisionSound; }
@ -2655,8 +2657,15 @@ namespace OpenSim.Region.Framework.Scenes
bool IsNotVolumeDtc = !VolumeDetectActive; bool IsNotVolumeDtc = !VolumeDetectActive;
if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && IsNotVolumeDtc) if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSoundVolume > 0.0f && CollisionSound != invalidCollisionSoundUUID)
{
if(CollisionSound != UUID.Zero)
SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false);
else
{
// default sounds
}
}
SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart);
if (IsNotVolumeDtc) if (IsNotVolumeDtc)
@ -4743,7 +4752,7 @@ namespace OpenSim.Region.Framework.Scenes
pa.OnCollisionUpdate -= PhysicsCollision; pa.OnCollisionUpdate -= PhysicsCollision;
bool hassound = ( CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f); bool hassound = ( CollisionSound != invalidCollisionSoundUUID);
scriptEvents CombinedEvents = AggregateScriptEvents; scriptEvents CombinedEvents = AggregateScriptEvents;
// merge with root part // merge with root part

View File

@ -4780,6 +4780,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); 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. // TODO: Parameter check logic required.
UUID soundId = UUID.Zero; UUID soundId = UUID.Zero;
if (!UUID.TryParse(impact_sound, out soundId)) if (!UUID.TryParse(impact_sound, out soundId))
@ -4795,8 +4801,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
m_host.TaskInventory.LockItemsForRead(false); m_host.TaskInventory.LockItemsForRead(false);
} }
m_host.CollisionSound = soundId;
m_host.CollisionSoundVolume = (float)impact_volume; m_host.CollisionSoundVolume = (float)impact_volume;
m_host.CollisionSound = soundId;
} }
public LSL_String llGetAnimation(string id) public LSL_String llGetAnimation(string id)

View File

@ -847,6 +847,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
part.CollisionSound = UUID.Zero;
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
EventQueue.Clear(); EventQueue.Clear();
m_Script.ResetVars(); m_Script.ResetVars();
@ -873,6 +874,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID); SceneObjectPart part = Engine.World.GetSceneObjectPart(LocalID);
part.Inventory.GetInventoryItem(ItemID).PermsMask = 0; part.Inventory.GetInventoryItem(ItemID).PermsMask = 0;
part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero; part.Inventory.GetInventoryItem(ItemID).PermsGranter = UUID.Zero;
part.CollisionSound = UUID.Zero;
AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
EventQueue.Clear(); EventQueue.Clear();