aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs30
1 files changed, 24 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index ce6415a..421cb08 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -416,6 +416,7 @@ namespace OpenSim.Region.Framework.Scenes
416 void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args) 416 void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args)
417 { 417 {
418 // TODO: don't create new blocks if recycling an old packet 418 // TODO: don't create new blocks if recycling an old packet
419 bool discardableEffects = true;
419 ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count]; 420 ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count];
420 for (int i = 0; i < args.Count; i++) 421 for (int i = 0; i < args.Count; i++)
421 { 422 {
@@ -427,17 +428,34 @@ namespace OpenSim.Region.Framework.Scenes
427 effect.Type = args[i].Type; 428 effect.Type = args[i].Type;
428 effect.TypeData = args[i].TypeData; 429 effect.TypeData = args[i].TypeData;
429 effectBlockArray[i] = effect; 430 effectBlockArray[i] = effect;
431
432 if ((EffectType)effect.Type != EffectType.LookAt && (EffectType)effect.Type != EffectType.Beam)
433 discardableEffects = false;
434
435 //m_log.DebugFormat("[YYY]: VE {0} {1} {2}", effect.AgentID, effect.Duration, (EffectType)effect.Type);
430 } 436 }
431 437
432 ForEachClient( 438 ForEachScenePresence(sp =>
433 delegate(IClientAPI client)
434 { 439 {
435 if (client.AgentId != remoteClient.AgentId) 440 if (sp.ControllingClient.AgentId != remoteClient.AgentId)
436 client.SendViewerEffect(effectBlockArray); 441 {
437 } 442 if (!discardableEffects ||
438 ); 443 (discardableEffects && ShouldSendDiscardableEffect(remoteClient, sp)))
444 {
445 //m_log.DebugFormat("[YYY]: Sending to {0}", sp.UUID);
446 sp.ControllingClient.SendViewerEffect(effectBlockArray);
447 }
448 //else
449 // m_log.DebugFormat("[YYY]: Not sending to {0}", sp.UUID);
450 }
451 });
439 } 452 }
440 453
454 private bool ShouldSendDiscardableEffect(IClientAPI thisClient, ScenePresence other)
455 {
456 return Vector3.Distance(other.CameraPosition, thisClient.SceneAgent.AbsolutePosition) < 10;
457 }
458
441 private class DescendentsRequestData 459 private class DescendentsRequestData
442 { 460 {
443 public IClientAPI RemoteClient; 461 public IClientAPI RemoteClient;