diff options
author | Charles Krinke | 2008-11-19 18:41:10 +0000 |
---|---|---|
committer | Charles Krinke | 2008-11-19 18:41:10 +0000 |
commit | 164ed57ad35b4496dcd8da6fb8ec6546300c9036 (patch) | |
tree | 923d8023fb5dbdcbb7b897e1816b8d302e663de1 /OpenSim/Region/Environment | |
parent | Mantis#2657. Thank you kindly, StrawberryFride for a patch that: (diff) | |
download | opensim-SC-164ed57ad35b4496dcd8da6fb8ec6546300c9036.zip opensim-SC-164ed57ad35b4496dcd8da6fb8ec6546300c9036.tar.gz opensim-SC-164ed57ad35b4496dcd8da6fb8ec6546300c9036.tar.bz2 opensim-SC-164ed57ad35b4496dcd8da6fb8ec6546300c9036.tar.xz |
Mantis#2638. Thank you kindly, Sacha Magne for a patch that:
Implementing "Play sound inworld". Currently a WIP .
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 3af947f..f243987 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | |||
@@ -340,6 +340,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
340 | public event OfferCallingCard OnOfferCallingCard; | 340 | public event OfferCallingCard OnOfferCallingCard; |
341 | public event AcceptCallingCard OnAcceptCallingCard; | 341 | public event AcceptCallingCard OnAcceptCallingCard; |
342 | public event DeclineCallingCard OnDeclineCallingCard; | 342 | public event DeclineCallingCard OnDeclineCallingCard; |
343 | public event SoundTrigger OnSoundTrigger; | ||
343 | 344 | ||
344 | 345 | ||
345 | #pragma warning restore 67 | 346 | #pragma warning restore 67 |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 7ea4686..a9014e1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -2342,12 +2342,31 @@ namespace OpenSim.Region.Environment.Scenes | |||
2342 | //Gesture | 2342 | //Gesture |
2343 | client.OnActivateGesture += ActivateGesture; | 2343 | client.OnActivateGesture += ActivateGesture; |
2344 | client.OnDeactivateGesture += DeactivateGesture; | 2344 | client.OnDeactivateGesture += DeactivateGesture; |
2345 | //sound | ||
2346 | client.OnSoundTrigger += SoundTrigger; | ||
2345 | 2347 | ||
2346 | client.OnObjectOwner += ObjectOwner; | 2348 | client.OnObjectOwner += ObjectOwner; |
2347 | 2349 | ||
2348 | // EventManager.TriggerOnNewClient(client); | 2350 | // EventManager.TriggerOnNewClient(client); |
2349 | } | 2351 | } |
2350 | 2352 | ||
2353 | // Sound | ||
2354 | public virtual void SoundTrigger( UUID soundId, UUID ownerID, UUID objectID, UUID parentID, | ||
2355 | float gain, Vector3 position, UInt64 handle) | ||
2356 | { | ||
2357 | foreach (ScenePresence p in GetAvatars()) | ||
2358 | { | ||
2359 | double dis = Util.GetDistanceTo(p.AbsolutePosition, position); | ||
2360 | if (dis > 100.0) // Max audio distance | ||
2361 | continue; | ||
2362 | |||
2363 | // Scale by distance | ||
2364 | gain = (float)((double)gain*((100.0 - dis) / 100.0)); | ||
2365 | p.ControllingClient.SendTriggeredSound(soundId, ownerID, objectID, parentID, handle, position, (float)gain); | ||
2366 | } | ||
2367 | |||
2368 | } | ||
2369 | |||
2351 | // Gesture | 2370 | // Gesture |
2352 | public virtual void ActivateGesture(IClientAPI client, UUID assetId, UUID gestureId) | 2371 | public virtual void ActivateGesture(IClientAPI client, UUID assetId, UUID gestureId) |
2353 | { | 2372 | { |