diff options
author | SignpostMarv | 2012-10-16 12:24:33 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-29 23:39:00 +0000 |
commit | 5abcecc7356bf58c479a7cff86581131a6ab3c9e (patch) | |
tree | 73a621d699527ada735b8518cd32074858f0c3c9 /OpenSim/Region/CoreModules | |
parent | fixing a bug in SceneObjectPart.SendSound where sounds would always come from... (diff) | |
download | opensim-SC_OLD-5abcecc7356bf58c479a7cff86581131a6ab3c9e.zip opensim-SC_OLD-5abcecc7356bf58c479a7cff86581131a6ab3c9e.tar.gz opensim-SC_OLD-5abcecc7356bf58c479a7cff86581131a6ab3c9e.tar.bz2 opensim-SC_OLD-5abcecc7356bf58c479a7cff86581131a6ab3c9e.tar.xz |
moving SendSound from SceneObjectPart to ISoundModule
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs index 6f61c32..37863ee 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModuleNonShared.cs | |||
@@ -278,6 +278,79 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
278 | m_host.SendFullUpdateToAllClients(); | 278 | m_host.SendFullUpdateToAllClients(); |
279 | } | 279 | } |
280 | 280 | ||
281 | public void SendSound(UUID objectID, string sound, double volume, | ||
282 | bool triggered, byte flags, float radius, bool useMaster, | ||
283 | bool isMaster) | ||
284 | { | ||
285 | SceneObjectPart part; | ||
286 | if (!m_scene.TryGetSceneObjectPart(objectID, out part)) | ||
287 | return; | ||
288 | |||
289 | volume = Util.Clip((float)volume, 0, 1); | ||
290 | |||
291 | UUID parentID = part.ParentGroup.UUID; | ||
292 | |||
293 | UUID soundID = UUID.Zero; | ||
294 | Vector3 position = part.AbsolutePosition; // region local | ||
295 | ulong regionHandle = m_scene.RegionInfo.RegionHandle; | ||
296 | |||
297 | if (!UUID.TryParse(sound, out soundID)) | ||
298 | { | ||
299 | // search sound file from inventory | ||
300 | lock (part.TaskInventory) | ||
301 | { | ||
302 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in part.TaskInventory) | ||
303 | { | ||
304 | if (item.Value.Type == (int)AssetType.Sound && item.Value.Name == sound) | ||
305 | { | ||
306 | soundID = item.Value.ItemID; | ||
307 | break; | ||
308 | } | ||
309 | } | ||
310 | } | ||
311 | } | ||
312 | |||
313 | if (soundID == UUID.Zero) | ||
314 | return; | ||
315 | |||
316 | if (useMaster) | ||
317 | { | ||
318 | if (isMaster) | ||
319 | { | ||
320 | if (triggered) | ||
321 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); | ||
322 | else | ||
323 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); | ||
324 | part.ParentGroup.PlaySoundMasterPrim = part; | ||
325 | if (triggered) | ||
326 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); | ||
327 | else | ||
328 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); | ||
329 | foreach (SceneObjectPart prim in part.ParentGroup.PlaySoundSlavePrims) | ||
330 | { | ||
331 | position = prim.AbsolutePosition; // region local | ||
332 | if (triggered) | ||
333 | TriggerSound(soundID, part.OwnerID, prim.UUID, parentID, volume, position, regionHandle, radius); | ||
334 | else | ||
335 | PlayAttachedSound(soundID, part.OwnerID, prim.UUID, volume, position, flags, radius); | ||
336 | } | ||
337 | part.ParentGroup.PlaySoundSlavePrims.Clear(); | ||
338 | part.ParentGroup.PlaySoundMasterPrim = null; | ||
339 | } | ||
340 | else | ||
341 | { | ||
342 | part.ParentGroup.PlaySoundSlavePrims.Add(part); | ||
343 | } | ||
344 | } | ||
345 | else | ||
346 | { | ||
347 | if (triggered) | ||
348 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); | ||
349 | else | ||
350 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); | ||
351 | } | ||
352 | } | ||
353 | |||
281 | #endregion | 354 | #endregion |
282 | } | 355 | } |
283 | } | 356 | } |