aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs133
1 files changed, 9 insertions, 124 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 27ef4c9..f79ac96 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2239,7 +2239,15 @@ namespace OpenSim.Region.Framework.Scenes
2239 2239
2240 // play the sound. 2240 // play the sound.
2241 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) 2241 if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f)
2242 SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); 2242 {
2243 ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
2244 if (soundModule != null)
2245 {
2246 soundModule.SendSound(UUID, CollisionSound,
2247 CollisionSoundVolume, true, (byte)0, 0, false,
2248 false);
2249 }
2250 }
2243 2251
2244 SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); 2252 SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart);
2245 SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); 2253 SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding);
@@ -2287,37 +2295,6 @@ namespace OpenSim.Region.Framework.Scenes
2287 ScheduleTerseUpdate(); 2295 ScheduleTerseUpdate();
2288 } 2296 }
2289 2297
2290 public void PreloadSound(string sound)
2291 {
2292 // UUID ownerID = OwnerID;
2293 UUID objectID = ParentGroup.RootPart.UUID;
2294 UUID soundID = UUID.Zero;
2295
2296 if (!UUID.TryParse(sound, out soundID))
2297 {
2298 //Trys to fetch sound id from prim's inventory.
2299 //Prim's inventory doesn't support non script items yet
2300
2301 lock (TaskInventory)
2302 {
2303 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2304 {
2305 if (item.Value.Name == sound)
2306 {
2307 soundID = item.Value.ItemID;
2308 break;
2309 }
2310 }
2311 }
2312 }
2313
2314 ParentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
2315 {
2316 if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100))
2317 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2318 });
2319 }
2320
2321 public void RemFlag(PrimFlags flag) 2298 public void RemFlag(PrimFlags flag)
2322 { 2299 {
2323 // PrimFlags prevflag = Flags; 2300 // PrimFlags prevflag = Flags;
@@ -2676,98 +2653,6 @@ namespace OpenSim.Region.Framework.Scenes
2676 } 2653 }
2677 2654
2678 /// <summary> 2655 /// <summary>
2679 /// Trigger or play an attached sound in this part's inventory.
2680 /// </summary>
2681 /// <param name="sound"></param>
2682 /// <param name="volume"></param>
2683 /// <param name="triggered"></param>
2684 /// <param name="flags"></param>
2685 public void SendSound(string sound, double volume, bool triggered, byte flags, float radius, bool useMaster, bool isMaster)
2686 {
2687 if (volume > 1)
2688 volume = 1;
2689 if (volume < 0)
2690 volume = 0;
2691
2692 UUID ownerID = OwnerID;
2693 UUID objectID = ParentGroup.RootPart.UUID;
2694 UUID parentID = ParentGroup.UUID;
2695
2696 UUID soundID = UUID.Zero;
2697 Vector3 position = AbsolutePosition; // region local
2698 ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
2699
2700 if (!UUID.TryParse(sound, out soundID))
2701 {
2702 // search sound file from inventory
2703 lock (TaskInventory)
2704 {
2705 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2706 {
2707 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
2708 {
2709 soundID = item.Value.ItemID;
2710 break;
2711 }
2712 }
2713 }
2714 }
2715
2716 if (soundID == UUID.Zero)
2717 return;
2718
2719 ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>();
2720 if (soundModule != null)
2721 {
2722 if (useMaster)
2723 {
2724 if (isMaster)
2725 {
2726 if (triggered)
2727 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
2728 else
2729 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
2730 ParentGroup.PlaySoundMasterPrim = this;
2731 ownerID = OwnerID;
2732 objectID = ParentGroup.RootPart.UUID;
2733 parentID = ParentGroup.UUID;
2734 position = AbsolutePosition; // region local
2735 regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle;
2736 if (triggered)
2737 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
2738 else
2739 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
2740 foreach (SceneObjectPart prim in ParentGroup.PlaySoundSlavePrims)
2741 {
2742 ownerID = prim.OwnerID;
2743 objectID = prim.ParentGroup.RootPart.UUID;
2744 parentID = prim.ParentGroup.UUID;
2745 position = prim.AbsolutePosition; // region local
2746 regionHandle = prim.ParentGroup.Scene.RegionInfo.RegionHandle;
2747 if (triggered)
2748 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
2749 else
2750 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
2751 }
2752 ParentGroup.PlaySoundSlavePrims.Clear();
2753 ParentGroup.PlaySoundMasterPrim = null;
2754 }
2755 else
2756 {
2757 ParentGroup.PlaySoundSlavePrims.Add(this);
2758 }
2759 }
2760 else
2761 {
2762 if (triggered)
2763 soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, radius);
2764 else
2765 soundModule.PlayAttachedSound(soundID, ownerID, objectID, volume, position, flags, radius);
2766 }
2767 }
2768 }
2769
2770 /// <summary>
2771 /// Send a terse update to all clients 2656 /// Send a terse update to all clients
2772 /// </summary> 2657 /// </summary>
2773 public void SendTerseUpdateToAllClients() 2658 public void SendTerseUpdateToAllClients()