diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ce6415a..46b2d2e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -252,8 +252,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
252 | if (part.ParentGroup.RootPart.LocalId != part.LocalId) | 252 | if (part.ParentGroup.RootPart.LocalId != part.LocalId) |
253 | return; | 253 | return; |
254 | 254 | ||
255 | bool isAttachment = false; | ||
256 | |||
257 | // This is wrong, wrong, wrong. Selection should not be | 255 | // This is wrong, wrong, wrong. Selection should not be |
258 | // handled by group, but by prim. Legacy cruft. | 256 | // handled by group, but by prim. Legacy cruft. |
259 | // TODO: Make selection flagging per prim! | 257 | // TODO: Make selection flagging per prim! |
@@ -262,17 +260,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
262 | || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId)) | 260 | || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId)) |
263 | part.ParentGroup.IsSelected = false; | 261 | part.ParentGroup.IsSelected = false; |
264 | 262 | ||
265 | if (part.ParentGroup.IsAttachment) | 263 | part.ParentGroup.ScheduleGroupForFullUpdate(); |
266 | isAttachment = true; | ||
267 | else | ||
268 | part.ParentGroup.ScheduleGroupForFullUpdate(); | ||
269 | 264 | ||
270 | // If it's not an attachment, and we are allowed to move it, | 265 | // If it's not an attachment, and we are allowed to move it, |
271 | // then we might have done so. If we moved across a parcel | 266 | // then we might have done so. If we moved across a parcel |
272 | // boundary, we will need to recount prims on the parcels. | 267 | // boundary, we will need to recount prims on the parcels. |
273 | // For attachments, that makes no sense. | 268 | // For attachments, that makes no sense. |
274 | // | 269 | // |
275 | if (!isAttachment) | 270 | if (!part.ParentGroup.IsAttachment) |
276 | { | 271 | { |
277 | if (Permissions.CanEditObject( | 272 | if (Permissions.CanEditObject( |
278 | part.UUID, remoteClient.AgentId) | 273 | part.UUID, remoteClient.AgentId) |
@@ -416,6 +411,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
416 | void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args) | 411 | void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args) |
417 | { | 412 | { |
418 | // TODO: don't create new blocks if recycling an old packet | 413 | // TODO: don't create new blocks if recycling an old packet |
414 | bool discardableEffects = true; | ||
419 | ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count]; | 415 | ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count]; |
420 | for (int i = 0; i < args.Count; i++) | 416 | for (int i = 0; i < args.Count; i++) |
421 | { | 417 | { |
@@ -427,17 +423,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
427 | effect.Type = args[i].Type; | 423 | effect.Type = args[i].Type; |
428 | effect.TypeData = args[i].TypeData; | 424 | effect.TypeData = args[i].TypeData; |
429 | effectBlockArray[i] = effect; | 425 | effectBlockArray[i] = effect; |
426 | |||
427 | if ((EffectType)effect.Type != EffectType.LookAt && (EffectType)effect.Type != EffectType.Beam) | ||
428 | discardableEffects = false; | ||
429 | |||
430 | //m_log.DebugFormat("[YYY]: VE {0} {1} {2}", effect.AgentID, effect.Duration, (EffectType)effect.Type); | ||
430 | } | 431 | } |
431 | 432 | ||
432 | ForEachClient( | 433 | ForEachScenePresence(sp => |
433 | delegate(IClientAPI client) | ||
434 | { | 434 | { |
435 | if (client.AgentId != remoteClient.AgentId) | 435 | if (sp.ControllingClient.AgentId != remoteClient.AgentId) |
436 | client.SendViewerEffect(effectBlockArray); | 436 | { |
437 | } | 437 | if (!discardableEffects || |
438 | ); | 438 | (discardableEffects && ShouldSendDiscardableEffect(remoteClient, sp))) |
439 | { | ||
440 | //m_log.DebugFormat("[YYY]: Sending to {0}", sp.UUID); | ||
441 | sp.ControllingClient.SendViewerEffect(effectBlockArray); | ||
442 | } | ||
443 | //else | ||
444 | // m_log.DebugFormat("[YYY]: Not sending to {0}", sp.UUID); | ||
445 | } | ||
446 | }); | ||
439 | } | 447 | } |
440 | 448 | ||
449 | private bool ShouldSendDiscardableEffect(IClientAPI thisClient, ScenePresence other) | ||
450 | { | ||
451 | return Vector3.Distance(other.CameraPosition, thisClient.SceneAgent.AbsolutePosition) < 10; | ||
452 | } | ||
453 | |||
441 | private class DescendentsRequestData | 454 | private class DescendentsRequestData |
442 | { | 455 | { |
443 | public IClientAPI RemoteClient; | 456 | public IClientAPI RemoteClient; |