mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/SceneObjectPart.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
This commit is contained in:
@@ -2895,38 +2895,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ScheduleTerseUpdate();
|
||||
}
|
||||
|
||||
public void PreloadSound(string sound)
|
||||
{
|
||||
// UUID ownerID = OwnerID;
|
||||
UUID objectID = ParentGroup.RootPart.UUID;
|
||||
UUID soundID = UUID.Zero;
|
||||
|
||||
if (!UUID.TryParse(sound, out soundID))
|
||||
{
|
||||
//Trys to fetch sound id from prim's inventory.
|
||||
//Prim's inventory doesn't support non script items yet
|
||||
|
||||
TaskInventory.LockItemsForRead(true);
|
||||
|
||||
foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
|
||||
{
|
||||
if (item.Value.Name == sound)
|
||||
{
|
||||
soundID = item.Value.ItemID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TaskInventory.LockItemsForRead(false);
|
||||
}
|
||||
|
||||
ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
|
||||
{
|
||||
if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100))
|
||||
sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
|
||||
});
|
||||
}
|
||||
|
||||
public void RemFlag(PrimFlags flag)
|
||||
{
|
||||
// PrimFlags prevflag = Flags;
|
||||
@@ -3297,126 +3265,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger or play an attached sound in this part's inventory.
|
||||
/// </summary>
|
||||
/// <param name="sound"></param>
|
||||
/// <param name="volume"></param>
|
||||
/// <param name="triggered"></param>
|
||||
/// <param name="flags"></param>
|
||||
public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster)
|
||||
{
|
||||
if (volume > 1)
|
||||
volume = 1;
|
||||
if (volume < 0)
|
||||
volume = 0;
|
||||
|
||||
UUID ownerID = OwnerID;
|
||||
UUID objectID = ParentGroup.RootPart.UUID;
|
||||
UUID parentID = ParentGroup.UUID;
|
||||
|
||||
UUID soundID = UUID.Zero;
|
||||
Vector3 position = AbsolutePosition; // region local
|
||||
ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
|
||||
|
||||
if (!UUID.TryParse(sound, out soundID))
|
||||
{
|
||||
// search sound file from inventory
|
||||
TaskInventory.LockItemsForRead(true);
|
||||
foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
|
||||
{
|
||||
if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
|
||||
{
|
||||
soundID = item.Value.ItemID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
TaskInventory.LockItemsForRead(false);
|
||||
}
|
||||
|
||||
if (soundID == UUID.Zero)
|
||||
return;
|
||||
|
||||
ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
|
||||
if (soundModule != null)
|
||||
{
|
||||
if (useMaster)
|
||||
{
|
||||
if (isMaster)
|
||||
{
|
||||
if (triggered)
|
||||
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
|
||||
else
|
||||
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
|
||||
ParentGroup.PlaySoundMasterPrim = this;
|
||||
ownerID = OwnerID;
|
||||
objectID = ParentGroup.RootPart.UUID;
|
||||
parentID = ParentGroup.UUID;
|
||||
position = AbsolutePosition; // region local
|
||||
regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
|
||||
if (triggered)
|
||||
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
|
||||
else
|
||||
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
|
||||
foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims)
|
||||
{
|
||||
ownerID = prim.OwnerID;
|
||||
objectID = prim.ParentGroup.RootPart.UUID;
|
||||
parentID = prim.ParentGroup.UUID;
|
||||
position = prim.AbsolutePosition; // region local
|
||||
regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle;
|
||||
if (triggered)
|
||||
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
|
||||
else
|
||||
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
|
||||
}
|
||||
ParentGroup.PlaySoundSlavePrims.Clear();
|
||||
ParentGroup.PlaySoundMasterPrim = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
ParentGroup.PlaySoundSlavePrims.Add(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (triggered)
|
||||
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
|
||||
else
|
||||
soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SendCollisionSound(UUID soundID, double volume, Vector3 position)
|
||||
{
|
||||
if (soundID == UUID.Zero)
|
||||
return;
|
||||
|
||||
ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
|
||||
if (soundModule == null)
|
||||
return;
|
||||
|
||||
if (volume > 1)
|
||||
volume = 1;
|
||||
if (volume < 0)
|
||||
volume = 0;
|
||||
|
||||
int now = Util.EnvironmentTickCount();
|
||||
if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200)
|
||||
return;
|
||||
|
||||
LastColSoundSentTime = now;
|
||||
|
||||
UUID ownerID = OwnerID;
|
||||
UUID objectID = ParentGroup.RootPart.UUID;
|
||||
UUID parentID = ParentGroup.UUID;
|
||||
ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
|
||||
|
||||
soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 );
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send a terse update to all clients
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user