diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 68 |
1 files changed, 52 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index df43271..8ebcd92 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -31,7 +31,6 @@ using System.Threading; | |||
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenMetaverse.Packets; | 32 | using OpenMetaverse.Packets; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | ||
35 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
36 | 35 | ||
37 | namespace OpenSim.Region.Framework.Scenes | 36 | namespace OpenSim.Region.Framework.Scenes |
@@ -145,6 +144,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
145 | } | 144 | } |
146 | 145 | ||
147 | /// <summary> | 146 | /// <summary> |
147 | /// | ||
148 | /// </summary> | ||
149 | /// <param name="message"></param> | ||
150 | /// <param name="type"></param> | ||
151 | /// <param name="channel"></param> | ||
152 | /// <param name="fromPos"></param> | ||
153 | /// <param name="fromName"></param> | ||
154 | /// <param name="fromAgentID"></param> | ||
155 | /// <param name="targetID"></param> | ||
156 | public void SimChatToAgent(UUID targetID, byte[] message, int channel, Vector3 fromPos, string fromName, UUID fromID, bool fromAgent) | ||
157 | { | ||
158 | SimChat(message, ChatTypeEnum.Region, channel, fromPos, fromName, fromID, targetID, fromAgent, false); | ||
159 | } | ||
160 | |||
161 | /// <summary> | ||
148 | /// Invoked when the client requests a prim. | 162 | /// Invoked when the client requests a prim. |
149 | /// </summary> | 163 | /// </summary> |
150 | /// <param name="primLocalID"></param> | 164 | /// <param name="primLocalID"></param> |
@@ -244,25 +258,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
244 | if (part.ParentGroup.RootPart.LocalId != part.LocalId) | 258 | if (part.ParentGroup.RootPart.LocalId != part.LocalId) |
245 | return; | 259 | return; |
246 | 260 | ||
247 | bool isAttachment = false; | ||
248 | |||
249 | // This is wrong, wrong, wrong. Selection should not be | 261 | // This is wrong, wrong, wrong. Selection should not be |
250 | // handled by group, but by prim. Legacy cruft. | 262 | // handled by group, but by prim. Legacy cruft. |
251 | // TODO: Make selection flagging per prim! | 263 | // TODO: Make selection flagging per prim! |
252 | // | 264 | // |
253 | part.ParentGroup.IsSelected = false; | 265 | part.ParentGroup.IsSelected = false; |
254 | 266 | ||
255 | if (part.ParentGroup.IsAttachment) | 267 | part.ParentGroup.ScheduleGroupForFullUpdate(); |
256 | isAttachment = true; | ||
257 | else | ||
258 | part.ParentGroup.ScheduleGroupForFullUpdate(); | ||
259 | 268 | ||
260 | // If it's not an attachment, and we are allowed to move it, | 269 | // If it's not an attachment, and we are allowed to move it, |
261 | // then we might have done so. If we moved across a parcel | 270 | // then we might have done so. If we moved across a parcel |
262 | // boundary, we will need to recount prims on the parcels. | 271 | // boundary, we will need to recount prims on the parcels. |
263 | // For attachments, that makes no sense. | 272 | // For attachments, that makes no sense. |
264 | // | 273 | // |
265 | if (!isAttachment) | 274 | if (!part.ParentGroup.IsAttachment) |
266 | { | 275 | { |
267 | if (Permissions.CanEditObject( | 276 | if (Permissions.CanEditObject( |
268 | part.UUID, remoteClient.AgentId) | 277 | part.UUID, remoteClient.AgentId) |
@@ -390,6 +399,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
390 | void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args) | 399 | void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args) |
391 | { | 400 | { |
392 | // TODO: don't create new blocks if recycling an old packet | 401 | // TODO: don't create new blocks if recycling an old packet |
402 | bool discardableEffects = true; | ||
393 | ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count]; | 403 | ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count]; |
394 | for (int i = 0; i < args.Count; i++) | 404 | for (int i = 0; i < args.Count; i++) |
395 | { | 405 | { |
@@ -401,17 +411,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
401 | effect.Type = args[i].Type; | 411 | effect.Type = args[i].Type; |
402 | effect.TypeData = args[i].TypeData; | 412 | effect.TypeData = args[i].TypeData; |
403 | effectBlockArray[i] = effect; | 413 | effectBlockArray[i] = effect; |
414 | |||
415 | if ((EffectType)effect.Type != EffectType.LookAt && (EffectType)effect.Type != EffectType.Beam) | ||
416 | discardableEffects = false; | ||
417 | |||
418 | //m_log.DebugFormat("[YYY]: VE {0} {1} {2}", effect.AgentID, effect.Duration, (EffectType)effect.Type); | ||
404 | } | 419 | } |
405 | 420 | ||
406 | ForEachClient( | 421 | ForEachScenePresence(sp => |
407 | delegate(IClientAPI client) | ||
408 | { | 422 | { |
409 | if (client.AgentId != remoteClient.AgentId) | 423 | if (sp.ControllingClient.AgentId != remoteClient.AgentId) |
410 | client.SendViewerEffect(effectBlockArray); | 424 | { |
411 | } | 425 | if (!discardableEffects || |
412 | ); | 426 | (discardableEffects && ShouldSendDiscardableEffect(remoteClient, sp))) |
427 | { | ||
428 | //m_log.DebugFormat("[YYY]: Sending to {0}", sp.UUID); | ||
429 | sp.ControllingClient.SendViewerEffect(effectBlockArray); | ||
430 | } | ||
431 | //else | ||
432 | // m_log.DebugFormat("[YYY]: Not sending to {0}", sp.UUID); | ||
433 | } | ||
434 | }); | ||
413 | } | 435 | } |
414 | 436 | ||
437 | private bool ShouldSendDiscardableEffect(IClientAPI thisClient, ScenePresence other) | ||
438 | { | ||
439 | return Vector3.Distance(other.CameraPosition, thisClient.SceneAgent.AbsolutePosition) < 10; | ||
440 | } | ||
441 | |||
415 | /// <summary> | 442 | /// <summary> |
416 | /// Tell the client about the various child items and folders contained in the requested folder. | 443 | /// Tell the client about the various child items and folders contained in the requested folder. |
417 | /// </summary> | 444 | /// </summary> |
@@ -459,7 +486,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
459 | 486 | ||
460 | void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) | 487 | void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) |
461 | { | 488 | { |
462 | SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); | 489 | try |
490 | { | ||
491 | SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); | ||
492 | } | ||
493 | catch (Exception e) | ||
494 | { | ||
495 | m_log.Error( | ||
496 | string.Format( | ||
497 | "[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e)); | ||
498 | } | ||
463 | } | 499 | } |
464 | 500 | ||
465 | void SendInventoryComplete(IAsyncResult iar) | 501 | void SendInventoryComplete(IAsyncResult iar) |