aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs32
1 files changed, 25 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index df43271..998c19e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -390,6 +390,7 @@ namespace OpenSim.Region.Framework.Scenes
390 void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args) 390 void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args)
391 { 391 {
392 // TODO: don't create new blocks if recycling an old packet 392 // TODO: don't create new blocks if recycling an old packet
393 bool discardableEffects = true;
393 ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count]; 394 ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count];
394 for (int i = 0; i < args.Count; i++) 395 for (int i = 0; i < args.Count; i++)
395 { 396 {
@@ -401,17 +402,34 @@ namespace OpenSim.Region.Framework.Scenes
401 effect.Type = args[i].Type; 402 effect.Type = args[i].Type;
402 effect.TypeData = args[i].TypeData; 403 effect.TypeData = args[i].TypeData;
403 effectBlockArray[i] = effect; 404 effectBlockArray[i] = effect;
405
406 if ((EffectType)effect.Type != EffectType.LookAt && (EffectType)effect.Type != EffectType.Beam)
407 discardableEffects = false;
408
409 //m_log.DebugFormat("[YYY]: VE {0} {1} {2}", effect.AgentID, effect.Duration, (EffectType)effect.Type);
404 } 410 }
405 411
406 ForEachClient( 412 ForEachScenePresence(sp =>
407 delegate(IClientAPI client)
408 { 413 {
409 if (client.AgentId != remoteClient.AgentId) 414 if (sp.ControllingClient.AgentId != remoteClient.AgentId)
410 client.SendViewerEffect(effectBlockArray); 415 {
411 } 416 if (!discardableEffects ||
412 ); 417 (discardableEffects && ShouldSendDiscardableEffect(remoteClient, sp)))
418 {
419 //m_log.DebugFormat("[YYY]: Sending to {0}", sp.UUID);
420 sp.ControllingClient.SendViewerEffect(effectBlockArray);
421 }
422 //else
423 // m_log.DebugFormat("[YYY]: Not sending to {0}", sp.UUID);
424 }
425 });
413 } 426 }
414 427
428 private bool ShouldSendDiscardableEffect(IClientAPI thisClient, ScenePresence other)
429 {
430 return Vector3.Distance(other.CameraPosition, thisClient.SceneAgent.AbsolutePosition) < 10;
431 }
432
415 /// <summary> 433 /// <summary>
416 /// Tell the client about the various child items and folders contained in the requested folder. 434 /// Tell the client about the various child items and folders contained in the requested folder.
417 /// </summary> 435 /// </summary>