diff options
author | Melanie | 2012-05-17 13:34:47 +0100 |
---|---|---|
committer | Melanie | 2012-05-17 13:34:47 +0100 |
commit | b4cd8b491bc53baa57da3b9efb5ab8b8287ddfe1 (patch) | |
tree | b764f0c0a7b7b6f6caeb4b3eddf1441d4f79ed17 /OpenSim/Region/Framework/Scenes | |
parent | Merge branch 'master' into careminster (diff) | |
parent | udp transfer: make number packets estimation coerent with number actually sen... (diff) | |
download | opensim-SC-b4cd8b491bc53baa57da3b9efb5ab8b8287ddfe1.zip opensim-SC-b4cd8b491bc53baa57da3b9efb5ab8b8287ddfe1.tar.gz opensim-SC-b4cd8b491bc53baa57da3b9efb5ab8b8287ddfe1.tar.bz2 opensim-SC-b4cd8b491bc53baa57da3b9efb5ab8b8287ddfe1.tar.xz |
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 271 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 45 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 |
3 files changed, 314 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs new file mode 100644 index 0000000..5d43027 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs | |||
@@ -0,0 +1,271 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | // Ubit 2012 | ||
28 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | |||
34 | namespace OpenSim.Region.Framework.Scenes | ||
35 | { | ||
36 | public static class CollisionSounds | ||
37 | { | ||
38 | // defines for cases | ||
39 | // only know one UUID for now (woodflesh) | ||
40 | |||
41 | private const int MaxMaterials = 7; | ||
42 | // part part | ||
43 | private static UUID snd_StoneStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
44 | private static UUID snd_StoneMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
45 | private static UUID snd_StoneGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
46 | private static UUID snd_StoneWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
47 | private static UUID snd_StoneFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
48 | private static UUID snd_StonePlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
49 | private static UUID snd_StoneRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
50 | |||
51 | private static UUID snd_MetalStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
52 | private static UUID snd_MetalMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
53 | private static UUID snd_MetalGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
54 | private static UUID snd_MetalWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
55 | private static UUID snd_MetalFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
56 | private static UUID snd_MetalPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
57 | private static UUID snd_MetalRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
58 | |||
59 | private static UUID snd_GlassStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
60 | private static UUID snd_GlassMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
61 | private static UUID snd_GlassGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
62 | private static UUID snd_GlassWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
63 | private static UUID snd_GlassFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
64 | private static UUID snd_GlassPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
65 | private static UUID snd_GlassRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
66 | |||
67 | private static UUID snd_WoodStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
68 | private static UUID snd_WoodMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
69 | private static UUID snd_WoodGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
70 | private static UUID snd_WoodWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
71 | private static UUID snd_WoodFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
72 | private static UUID snd_WoodPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
73 | private static UUID snd_WoodRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
74 | |||
75 | private static UUID snd_FleshStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
76 | private static UUID snd_FleshMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
77 | private static UUID snd_FleshGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
78 | private static UUID snd_FleshWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
79 | private static UUID snd_FleshFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
80 | private static UUID snd_FleshPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
81 | private static UUID snd_FleshRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
82 | |||
83 | private static UUID snd_PlasticStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
84 | private static UUID snd_PlasticMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
85 | private static UUID snd_PlasticGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
86 | private static UUID snd_PlasticWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
87 | private static UUID snd_PlasticFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
88 | private static UUID snd_PlasticPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
89 | private static UUID snd_PlasticRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
90 | |||
91 | private static UUID snd_RubberStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
92 | private static UUID snd_RubberMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
93 | private static UUID snd_RubberGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
94 | private static UUID snd_RubberWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
95 | private static UUID snd_RubberFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
96 | private static UUID snd_RubberPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
97 | private static UUID snd_RubberRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
98 | |||
99 | // terrain part | ||
100 | private static UUID snd_TerrainStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
101 | private static UUID snd_TerrainMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
102 | private static UUID snd_TerrainGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
103 | private static UUID snd_TerrainWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
104 | private static UUID snd_TerrainFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
105 | private static UUID snd_TerrainPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
106 | private static UUID snd_TerrainRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
107 | |||
108 | public static UUID[] m_TerrainPart = { | ||
109 | snd_TerrainStone, | ||
110 | snd_TerrainMetal, | ||
111 | snd_TerrainGlass, | ||
112 | snd_TerrainWood, | ||
113 | snd_TerrainFlesh, | ||
114 | snd_TerrainPlastic, | ||
115 | snd_TerrainRubber | ||
116 | }; | ||
117 | |||
118 | public static UUID[] m_PartPart = { | ||
119 | snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber, | ||
120 | snd_MetalStone, snd_MetalMetal, snd_MetalGlass, snd_MetalWood, snd_MetalFlesh, snd_MetalPlastic, snd_MetalRubber, | ||
121 | snd_GlassStone, snd_GlassMetal, snd_GlassGlass, snd_GlassWood, snd_GlassFlesh, snd_GlassPlastic, snd_GlassRubber, | ||
122 | snd_WoodStone, snd_WoodMetal, snd_WoodGlass, snd_WoodWood, snd_WoodFlesh, snd_WoodPlastic, snd_WoodRubber, | ||
123 | snd_FleshStone, snd_FleshMetal, snd_FleshGlass, snd_FleshWood, snd_FleshFlesh, snd_FleshPlastic, snd_FleshRubber, | ||
124 | snd_PlasticStone, snd_PlasticMetal, snd_PlasticGlass, snd_PlasticWood, snd_PlasticFlesh, snd_PlasticPlastic, snd_PlasticRubber, | ||
125 | snd_RubberStone, snd_RubberMetal, snd_RubberGlass, snd_RubberWood, snd_RubberFlesh, snd_RubberPlastic, snd_RubberRubber | ||
126 | }; | ||
127 | |||
128 | public static void PartCollisionSound(SceneObjectPart part,List<uint> Colliders) | ||
129 | { | ||
130 | if(Colliders.Count == 0 || part == null) | ||
131 | return; | ||
132 | |||
133 | if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0) | ||
134 | return; | ||
135 | |||
136 | if (part.ParentGroup == null) | ||
137 | return; | ||
138 | |||
139 | if (part.CollisionSound == part.invalidCollisionSoundUUID) | ||
140 | return; | ||
141 | |||
142 | UUID soundID; | ||
143 | int otherMaterial; | ||
144 | |||
145 | Vector3 position = part.AbsolutePosition; | ||
146 | |||
147 | if (part.CollisionSound != UUID.Zero) | ||
148 | { | ||
149 | if (part.CollisionSoundVolume > 0.0f) | ||
150 | part.SendCollisionSound(part.CollisionSound, part.CollisionSoundVolume, position); | ||
151 | return; | ||
152 | } | ||
153 | |||
154 | int thisMaterial = (int) part.Material; | ||
155 | if (thisMaterial >= MaxMaterials) | ||
156 | thisMaterial = 3; | ||
157 | |||
158 | int thisMatScaled = thisMaterial * MaxMaterials; | ||
159 | int index; | ||
160 | |||
161 | bool doneownsound = false; | ||
162 | |||
163 | foreach (uint Id in Colliders) | ||
164 | { | ||
165 | if (Id == 0) | ||
166 | { | ||
167 | if (!doneownsound) | ||
168 | { | ||
169 | soundID = m_TerrainPart[thisMaterial]; | ||
170 | part.SendCollisionSound(soundID, 1.0, position); | ||
171 | doneownsound = true; | ||
172 | } | ||
173 | continue; | ||
174 | } | ||
175 | |||
176 | SceneObjectPart otherPart = part.ParentGroup.Scene.GetSceneObjectPart(Id); | ||
177 | if (otherPart != null) | ||
178 | { | ||
179 | if (otherPart.CollisionSound == part.invalidCollisionSoundUUID || otherPart.VolumeDetectActive) | ||
180 | continue; | ||
181 | if (otherPart.CollisionSound != UUID.Zero) | ||
182 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, position); | ||
183 | else | ||
184 | { | ||
185 | otherMaterial = (int)otherPart.Material; | ||
186 | if (otherMaterial >= MaxMaterials) | ||
187 | otherMaterial = 3; | ||
188 | index = thisMatScaled + otherMaterial; | ||
189 | soundID = m_PartPart[index]; | ||
190 | if (doneownsound) | ||
191 | otherPart.SendCollisionSound(soundID, 1.0, position); | ||
192 | else | ||
193 | { | ||
194 | part.SendCollisionSound(soundID, 1.0, position); | ||
195 | doneownsound = true; | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | /* avatars get notification let them trigger the sound | ||
200 | else if (!doneownsound) | ||
201 | { | ||
202 | ScenePresence av = part.ParentGroup.Scene.GetScenePresence(Id); | ||
203 | if (av != null && (!av.IsChildAgent)) | ||
204 | { | ||
205 | index = thisMatScaled + 4; // flesh | ||
206 | soundID = m_PartPart[index]; | ||
207 | part.SendCollisionSound(soundID, 1.0); | ||
208 | doneownsound = true; | ||
209 | } | ||
210 | } | ||
211 | */ | ||
212 | } | ||
213 | } | ||
214 | |||
215 | public static void AvatarCollisionSound(ScenePresence av, List<uint> Colliders) | ||
216 | { | ||
217 | if (Colliders.Count == 0 || av == null) | ||
218 | return; | ||
219 | |||
220 | UUID soundID; | ||
221 | int otherMaterial; | ||
222 | |||
223 | int thisMaterial = 3; | ||
224 | |||
225 | int thisMatScaled = thisMaterial * MaxMaterials; | ||
226 | int index; | ||
227 | // bool doneownsound = false; | ||
228 | |||
229 | Vector3 position = av.AbsolutePosition; | ||
230 | |||
231 | foreach (uint Id in Colliders) | ||
232 | { | ||
233 | if (Id == 0) | ||
234 | { | ||
235 | continue; | ||
236 | } | ||
237 | |||
238 | SceneObjectPart otherPart = av.Scene.GetSceneObjectPart(Id); | ||
239 | if (otherPart != null) | ||
240 | { | ||
241 | if (otherPart.CollisionSound == otherPart.invalidCollisionSoundUUID) | ||
242 | continue; | ||
243 | if (otherPart.CollisionSound != UUID.Zero) | ||
244 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, position); | ||
245 | else | ||
246 | { | ||
247 | otherMaterial = (int)otherPart.Material; | ||
248 | if (otherMaterial >= MaxMaterials) | ||
249 | otherMaterial = 3; | ||
250 | index = thisMatScaled + otherMaterial; | ||
251 | soundID = m_PartPart[index]; | ||
252 | otherPart.SendCollisionSound(soundID, 1.0, position); | ||
253 | } | ||
254 | } | ||
255 | /* | ||
256 | else if (!doneownsound) | ||
257 | { | ||
258 | ScenePresence otherav = av.Scene.GetScenePresence(Id); | ||
259 | if (otherav != null && (!otherav.IsChildAgent)) | ||
260 | { | ||
261 | soundID = snd_FleshFlesh; | ||
262 | av.SendCollisionSound(soundID, 1.0); | ||
263 | doneownsound = true; | ||
264 | } | ||
265 | } | ||
266 | */ | ||
267 | } | ||
268 | } | ||
269 | |||
270 | } | ||
271 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a1f434e..221a32b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -188,6 +188,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
188 | 188 | ||
189 | public double SoundRadius; | 189 | public double SoundRadius; |
190 | 190 | ||
191 | |||
191 | public uint TimeStampFull; | 192 | public uint TimeStampFull; |
192 | 193 | ||
193 | public uint TimeStampLastActivity; // Will be used for AutoReturn | 194 | public uint TimeStampLastActivity; // Will be used for AutoReturn |
@@ -332,6 +333,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
332 | private UUID m_collisionSound; | 333 | private UUID m_collisionSound; |
333 | private float m_collisionSoundVolume; | 334 | private float m_collisionSoundVolume; |
334 | 335 | ||
336 | private DateTime LastColSoundSentTime; | ||
337 | |||
335 | 338 | ||
336 | private SOPVehicle m_vehicle = null; | 339 | private SOPVehicle m_vehicle = null; |
337 | 340 | ||
@@ -371,6 +374,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
371 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from | 374 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from |
372 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log | 375 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log |
373 | m_inventory = new SceneObjectPartInventory(this); | 376 | m_inventory = new SceneObjectPartInventory(this); |
377 | LastColSoundSentTime = DateTime.UtcNow; | ||
374 | } | 378 | } |
375 | 379 | ||
376 | /// <summary> | 380 | /// <summary> |
@@ -1347,11 +1351,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1347 | set { m_sitAnimation = value; } | 1351 | set { m_sitAnimation = value; } |
1348 | } | 1352 | } |
1349 | 1353 | ||
1354 | public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); | ||
1355 | |||
1350 | public UUID CollisionSound | 1356 | public UUID CollisionSound |
1351 | { | 1357 | { |
1352 | get { return m_collisionSound; } | 1358 | get { return m_collisionSound; } |
1353 | set | 1359 | set |
1354 | { | 1360 | { |
1355 | m_collisionSound = value; | 1361 | m_collisionSound = value; |
1356 | aggregateScriptEvents(); | 1362 | aggregateScriptEvents(); |
1357 | } | 1363 | } |
@@ -2640,7 +2646,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2640 | 2646 | ||
2641 | else | 2647 | else |
2642 | { | 2648 | { |
2643 | |||
2644 | // calculate things that started colliding this time | 2649 | // calculate things that started colliding this time |
2645 | // and build up list of colliders this time | 2650 | // and build up list of colliders this time |
2646 | foreach (uint localid in collissionswith.Keys) | 2651 | foreach (uint localid in collissionswith.Keys) |
@@ -2665,12 +2670,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2665 | foreach (uint localID in endedColliders) | 2670 | foreach (uint localID in endedColliders) |
2666 | m_lastColliders.Remove(localID); | 2671 | m_lastColliders.Remove(localID); |
2667 | } | 2672 | } |
2673 | |||
2668 | // play the sound. | 2674 | // play the sound. |
2669 | 2675 | ||
2670 | bool IsNotVolumeDtc = !VolumeDetectActive; | 2676 | bool IsNotVolumeDtc = !VolumeDetectActive; |
2671 | 2677 | ||
2672 | if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && IsNotVolumeDtc) | 2678 | if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSound != invalidCollisionSoundUUID) |
2673 | SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); | 2679 | CollisionSounds.PartCollisionSound(this, startedColliders); |
2674 | 2680 | ||
2675 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); | 2681 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); |
2676 | if (IsNotVolumeDtc) | 2682 | if (IsNotVolumeDtc) |
@@ -3204,6 +3210,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
3204 | } | 3210 | } |
3205 | } | 3211 | } |
3206 | 3212 | ||
3213 | public void SendCollisionSound(UUID soundID, double volume, Vector3 position) | ||
3214 | { | ||
3215 | if (soundID == UUID.Zero) | ||
3216 | return; | ||
3217 | |||
3218 | ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>(); | ||
3219 | if (soundModule == null) | ||
3220 | return; | ||
3221 | |||
3222 | if (volume > 1) | ||
3223 | volume = 1; | ||
3224 | if (volume < 0) | ||
3225 | volume = 0; | ||
3226 | |||
3227 | DateTime now = DateTime.UtcNow; | ||
3228 | if((now - LastColSoundSentTime).Milliseconds < 200) // reduce rate to 5 per sec per part ?? | ||
3229 | return; | ||
3230 | |||
3231 | LastColSoundSentTime = now; | ||
3232 | |||
3233 | UUID ownerID = OwnerID; | ||
3234 | UUID objectID = ParentGroup.RootPart.UUID; | ||
3235 | UUID parentID = ParentGroup.UUID; | ||
3236 | ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; | ||
3237 | |||
3238 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 ); | ||
3239 | } | ||
3240 | |||
3241 | |||
3207 | /// <summary> | 3242 | /// <summary> |
3208 | /// Send a terse update to all clients | 3243 | /// Send a terse update to all clients |
3209 | /// </summary> | 3244 | /// </summary> |
@@ -4757,7 +4792,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4757 | 4792 | ||
4758 | pa.OnCollisionUpdate -= PhysicsCollision; | 4793 | pa.OnCollisionUpdate -= PhysicsCollision; |
4759 | 4794 | ||
4760 | bool hassound = ( CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f); | 4795 | bool hassound = ( CollisionSound != invalidCollisionSoundUUID); |
4761 | scriptEvents CombinedEvents = AggregateScriptEvents; | 4796 | scriptEvents CombinedEvents = AggregateScriptEvents; |
4762 | 4797 | ||
4763 | // merge with root part | 4798 | // merge with root part |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8a6a6b4..913942f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3432,7 +3432,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3432 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 3432 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
3433 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 3433 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
3434 | PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong | 3434 | PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong |
3435 | PhysicsActor.SubscribeEvents(500); | 3435 | PhysicsActor.SubscribeEvents(100); |
3436 | PhysicsActor.LocalID = LocalId; | 3436 | PhysicsActor.LocalID = LocalId; |
3437 | } | 3437 | } |
3438 | 3438 | ||
@@ -4325,6 +4325,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4325 | // do event notification | 4325 | // do event notification |
4326 | if (startedColliders.Count > 0) | 4326 | if (startedColliders.Count > 0) |
4327 | { | 4327 | { |
4328 | CollisionSounds.AvatarCollisionSound(this, startedColliders); | ||
4329 | |||
4328 | ColliderArgs StartCollidingMessage = new ColliderArgs(); | 4330 | ColliderArgs StartCollidingMessage = new ColliderArgs(); |
4329 | List<DetectedObject> colliding = new List<DetectedObject>(); | 4331 | List<DetectedObject> colliding = new List<DetectedObject>(); |
4330 | foreach (uint localId in startedColliders) | 4332 | foreach (uint localId in startedColliders) |