throttle collision sounds on a SOG.
parent
ead95e85c5
commit
cc5d6f6b7b
|
@ -116,16 +116,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist)
|
public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist)
|
||||||
{
|
{
|
||||||
|
if (part.CollisionSoundType < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (collidersinfolist.Count == 0 || part == null)
|
if (collidersinfolist.Count == 0 || part == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0)
|
if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (part.ParentGroup == null)
|
SceneObjectGroup sog = part.ParentGroup;
|
||||||
|
if (sog == null || sog.IsDeleted || sog.inTransit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (part.CollisionSoundType < 0)
|
if(sog.CollisionSoundThrootled(part.CollisionSoundType))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float volume = part.CollisionSoundVolume;
|
float volume = part.CollisionSoundVolume;
|
||||||
|
@ -189,15 +193,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneObjectPart otherPart = part.ParentGroup.Scene.GetSceneObjectPart(id);
|
SceneObjectPart otherPart = sog.Scene.GetSceneObjectPart(id);
|
||||||
if (otherPart != null)
|
if (otherPart != null)
|
||||||
{
|
{
|
||||||
if (otherPart.CollisionSoundType < 0 || otherPart.VolumeDetectActive)
|
SceneObjectGroup othersog = otherPart.ParentGroup;
|
||||||
|
if(othersog == null || othersog.IsDeleted || othersog.inTransit)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int otherType = otherPart.CollisionSoundType;
|
||||||
|
if (otherType < 0 || otherPart.VolumeDetectActive)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!HaveSound)
|
if (!HaveSound)
|
||||||
{
|
{
|
||||||
if (otherPart.CollisionSoundType == 1)
|
if(othersog.CollisionSoundThrootled(otherType))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (otherType == 1)
|
||||||
{
|
{
|
||||||
soundID = otherPart.CollisionSound;
|
soundID = otherPart.CollisionSound;
|
||||||
volume = otherPart.CollisionSoundVolume;
|
volume = otherPart.CollisionSoundVolume;
|
||||||
|
@ -206,7 +218,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (otherPart.CollisionSoundType == 2)
|
if (otherType == 2)
|
||||||
{
|
{
|
||||||
volume = otherPart.CollisionSoundVolume;
|
volume = otherPart.CollisionSoundVolume;
|
||||||
if (volume == 0.0f)
|
if (volume == 0.0f)
|
||||||
|
|
|
@ -1259,6 +1259,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
set { m_LoopSoundSlavePrims = value; }
|
set { m_LoopSoundSlavePrims = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double m_lastCollisionSoundMS;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The UUID for the region this object is in.
|
/// The UUID for the region this object is in.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1336,7 +1338,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SceneObjectGroup()
|
public SceneObjectGroup()
|
||||||
{
|
{
|
||||||
|
m_lastCollisionSoundMS = Util.GetTimeStampMS() + 1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -5528,7 +5530,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CollisionSoundThrootled(int collisionSoundType)
|
||||||
|
{
|
||||||
|
double time = m_lastCollisionSoundMS;
|
||||||
|
// m_lastCollisionSoundMS = Util.GetTimeStampMS();
|
||||||
|
// time = m_lastCollisionSoundMS - time;
|
||||||
|
double now = Util.GetTimeStampMS();
|
||||||
|
time = now - time;
|
||||||
|
switch (collisionSoundType)
|
||||||
|
{
|
||||||
|
case 0: // default sounds
|
||||||
|
case 2: // default sounds with volume set by script
|
||||||
|
if(time < 300.0)
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case 1: // selected sound
|
||||||
|
if(time < 200.0)
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m_lastCollisionSoundMS = now;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue