diff options
author | Melanie | 2013-03-31 20:27:46 +0200 |
---|---|---|
committer | Melanie | 2013-03-31 20:27:46 +0200 |
commit | f142e1f3941165f29f390132f53fc5e88b40c883 (patch) | |
tree | 1f1ddd276fd940f86aa88b61692ecd68a0d2084a /OpenSim/Region/CoreModules | |
parent | Export permission, part two. Setting export perms for textures and clothing w... (diff) | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC-f142e1f3941165f29f390132f53fc5e88b40c883.zip opensim-SC-f142e1f3941165f29f390132f53fc5e88b40c883.tar.gz opensim-SC-f142e1f3941165f29f390132f53fc5e88b40c883.tar.bz2 opensim-SC-f142e1f3941165f29f390132f53fc5e88b40c883.tar.xz |
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Diffstat (limited to '')
8 files changed, 461 insertions, 147 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f62512e..cb724aa 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -49,6 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
49 | { | 49 | { |
50 | #region INonSharedRegionModule | 50 | #region INonSharedRegionModule |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | |||
53 | public int DebugLevel { get; set; } | ||
52 | 54 | ||
53 | private Scene m_scene; | 55 | private Scene m_scene; |
54 | private IInventoryAccessModule m_invAccessModule; | 56 | private IInventoryAccessModule m_invAccessModule; |
@@ -76,10 +78,66 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
76 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); | 78 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); |
77 | 79 | ||
78 | if (Enabled) | 80 | if (Enabled) |
81 | { | ||
79 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 82 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; |
83 | m_scene.EventManager.OnStartScript += (localID, itemID) => HandleScriptStateChange(localID, true); | ||
84 | m_scene.EventManager.OnStopScript += (localID, itemID) => HandleScriptStateChange(localID, false); | ||
85 | |||
86 | MainConsole.Instance.Commands.AddCommand( | ||
87 | "Debug", | ||
88 | false, | ||
89 | "debug attachments", | ||
90 | "debug attachments [0|1]", | ||
91 | "Turn on attachments debugging\n" | ||
92 | + " <= 0 - turns off debugging\n" | ||
93 | + " >= 1 - turns on attachment message logging\n", | ||
94 | HandleDebugAttachments); | ||
95 | } | ||
80 | 96 | ||
81 | // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI | 97 | // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI |
82 | } | 98 | } |
99 | |||
100 | private void HandleDebugAttachments(string module, string[] args) | ||
101 | { | ||
102 | int debugLevel; | ||
103 | |||
104 | if (!(args.Length == 3 && int.TryParse(args[2], out debugLevel))) | ||
105 | { | ||
106 | MainConsole.Instance.OutputFormat("Usage: debug attachments [0|1]"); | ||
107 | } | ||
108 | else | ||
109 | { | ||
110 | DebugLevel = debugLevel; | ||
111 | MainConsole.Instance.OutputFormat( | ||
112 | "Set event queue debug level to {0} in {1}", DebugLevel, m_scene.Name); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | /// <summary> | ||
117 | /// Listen for client triggered running state changes so that we can persist the script's object if necessary. | ||
118 | /// </summary> | ||
119 | /// <param name='localID'></param> | ||
120 | /// <param name='itemID'></param> | ||
121 | private void HandleScriptStateChange(uint localID, bool started) | ||
122 | { | ||
123 | SceneObjectGroup sog = m_scene.GetGroupByPrim(localID); | ||
124 | if (sog != null && sog.IsAttachment) | ||
125 | { | ||
126 | if (!started) | ||
127 | { | ||
128 | // FIXME: This is a convoluted way for working out whether the script state has changed to stop | ||
129 | // because it has been manually stopped or because the stop was called in UpdateDetachedObject() below | ||
130 | // This needs to be handled in a less tangled way. | ||
131 | ScenePresence sp = m_scene.GetScenePresence(sog.AttachedAvatar); | ||
132 | if (sp.ControllingClient.IsActive) | ||
133 | sog.HasGroupChanged = true; | ||
134 | } | ||
135 | else | ||
136 | { | ||
137 | sog.HasGroupChanged = true; | ||
138 | } | ||
139 | } | ||
140 | } | ||
83 | 141 | ||
84 | public void RemoveRegion(Scene scene) | 142 | public void RemoveRegion(Scene scene) |
85 | { | 143 | { |
@@ -153,10 +211,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
153 | } | 211 | } |
154 | } | 212 | } |
155 | 213 | ||
156 | /// <summary> | ||
157 | /// RezAttachments. This should only be called upon login on the first region. | ||
158 | /// Attachment rezzings on crossings and TPs are done in a different way. | ||
159 | /// </summary> | ||
160 | public void RezAttachments(IScenePresence sp) | 214 | public void RezAttachments(IScenePresence sp) |
161 | { | 215 | { |
162 | if (!Enabled) | 216 | if (!Enabled) |
@@ -165,10 +219,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
165 | if (null == sp.Appearance) | 219 | if (null == sp.Appearance) |
166 | { | 220 | { |
167 | m_log.WarnFormat("[ATTACHMENTS MODULE]: Appearance has not been initialized for agent {0}", sp.UUID); | 221 | m_log.WarnFormat("[ATTACHMENTS MODULE]: Appearance has not been initialized for agent {0}", sp.UUID); |
222 | |||
168 | return; | 223 | return; |
169 | } | 224 | } |
170 | 225 | ||
171 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0}", sp.Name); | 226 | if (sp.GetAttachments().Count > 0) |
227 | { | ||
228 | if (DebugLevel > 0) | ||
229 | m_log.DebugFormat( | ||
230 | "[ATTACHMENTS MODULE]: Not doing simulator-side attachment rez for {0} in {1} as their viewer has already rezzed attachments", | ||
231 | m_scene.Name, sp.Name); | ||
232 | |||
233 | return; | ||
234 | } | ||
235 | |||
236 | if (DebugLevel > 0) | ||
237 | m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0} from simulator-side", sp.Name); | ||
172 | 238 | ||
173 | XmlDocument doc = new XmlDocument(); | 239 | XmlDocument doc = new XmlDocument(); |
174 | string stateData = String.Empty; | 240 | string stateData = String.Empty; |
@@ -235,10 +301,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
235 | 301 | ||
236 | // If we're an NPC then skip all the item checks and manipulations since we don't have an | 302 | // If we're an NPC then skip all the item checks and manipulations since we don't have an |
237 | // inventory right now. | 303 | // inventory right now. |
238 | if (sp.PresenceType == PresenceType.Npc) | 304 | RezSingleAttachmentFromInventoryInternal( |
239 | RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null, true); | 305 | sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, p, true, null); |
240 | else | ||
241 | RezSingleAttachmentFromInventory(sp, attach.ItemID, p | (uint)0x80, d); | ||
242 | } | 306 | } |
243 | catch (Exception e) | 307 | catch (Exception e) |
244 | { | 308 | { |
@@ -254,7 +318,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
254 | if (!Enabled) | 318 | if (!Enabled) |
255 | return; | 319 | return; |
256 | 320 | ||
257 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); | 321 | if (DebugLevel > 0) |
322 | m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); | ||
258 | 323 | ||
259 | List<SceneObjectGroup> attachments = sp.GetAttachments(); | 324 | List<SceneObjectGroup> attachments = sp.GetAttachments(); |
260 | 325 | ||
@@ -287,9 +352,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
287 | if (!Enabled) | 352 | if (!Enabled) |
288 | return; | 353 | return; |
289 | 354 | ||
290 | // m_log.DebugFormat( | 355 | if (DebugLevel > 0) |
291 | // "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", | 356 | m_log.DebugFormat( |
292 | // m_scene.RegionInfo.RegionName, sp.Name, silent); | 357 | "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", |
358 | m_scene.RegionInfo.RegionName, sp.Name, silent); | ||
293 | 359 | ||
294 | foreach (SceneObjectGroup sop in sp.GetAttachments()) | 360 | foreach (SceneObjectGroup sop in sp.GetAttachments()) |
295 | { | 361 | { |
@@ -299,12 +365,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
299 | sp.ClearAttachments(); | 365 | sp.ClearAttachments(); |
300 | } | 366 | } |
301 | 367 | ||
302 | public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp, bool append) | 368 | public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool addToInventory, bool append) |
303 | { | 369 | { |
304 | if (!Enabled) | 370 | if (!Enabled) |
305 | return false; | 371 | return false; |
306 | 372 | ||
307 | return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, temp, false, append); | 373 | return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, addToInventory, false, append); |
308 | } | 374 | } |
309 | 375 | ||
310 | /// <summary> | 376 | /// <summary> |
@@ -315,9 +381,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
315 | /// <param name='group'>The object to attach.</param> | 381 | /// <param name='group'>The object to attach.</param> |
316 | /// <param name='attachmentPt'></param> | 382 | /// <param name='attachmentPt'></param> |
317 | /// <param name='silent'></param> | 383 | /// <param name='silent'></param> |
318 | /// <param name='temp'></param> | 384 | /// <param name='addToInventory'>If true then add object to user inventory.</param> |
319 | /// <param name='resumeScripts'>If true then scripts are resumed on the attached object.</param> | 385 | /// <param name='resumeScripts'>If true then scripts are resumed on the attached object.</param> |
320 | private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp, bool resumeScripts, bool append) | 386 | private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool addToInventory, bool resumeScripts, bool append) |
321 | { | 387 | { |
322 | // m_log.DebugFormat( | 388 | // m_log.DebugFormat( |
323 | // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", | 389 | // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", |
@@ -334,9 +400,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
334 | 400 | ||
335 | if (group.GetSittingAvatarsCount() != 0) | 401 | if (group.GetSittingAvatarsCount() != 0) |
336 | { | 402 | { |
337 | // m_log.WarnFormat( | 403 | if (DebugLevel > 0) |
338 | // "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since {4} avatars are still sitting on it", | 404 | m_log.WarnFormat( |
339 | // group.Name, group.LocalId, sp.Name, attachmentPt, group.GetSittingAvatarsCount()); | 405 | "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since {4} avatars are still sitting on it", |
406 | group.Name, group.LocalId, sp.Name, attachmentPt, group.GetSittingAvatarsCount()); | ||
340 | 407 | ||
341 | return false; | 408 | return false; |
342 | } | 409 | } |
@@ -372,6 +439,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
372 | 439 | ||
373 | List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt); | 440 | List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt); |
374 | 441 | ||
442 | if (attachments.Contains(group)) | ||
443 | { | ||
444 | if (DebugLevel > 0) | ||
445 | m_log.WarnFormat( | ||
446 | "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached", | ||
447 | group.Name, group.LocalId, sp.Name, attachmentPt); | ||
448 | |||
449 | return false; | ||
450 | } | ||
451 | |||
375 | // If we already have 5, remove the oldest until only 4 are left. Skip over temp ones | 452 | // If we already have 5, remove the oldest until only 4 are left. Skip over temp ones |
376 | while (attachments.Count >= 5) | 453 | while (attachments.Count >= 5) |
377 | { | 454 | { |
@@ -395,8 +472,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
395 | group.AttachmentPoint = attachmentPt; | 472 | group.AttachmentPoint = attachmentPt; |
396 | group.AbsolutePosition = attachPos; | 473 | group.AbsolutePosition = attachPos; |
397 | 474 | ||
398 | if (sp.PresenceType != PresenceType.Npc) | 475 | if (addToInventory && sp.PresenceType != PresenceType.Npc) |
399 | UpdateUserInventoryWithAttachment(sp, group, attachmentPt, temp, append); | 476 | UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append); |
400 | 477 | ||
401 | AttachToAgent(sp, group, attachmentPt, attachPos, silent); | 478 | AttachToAgent(sp, group, attachmentPt, attachPos, silent); |
402 | 479 | ||
@@ -415,17 +492,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
415 | return true; | 492 | return true; |
416 | } | 493 | } |
417 | 494 | ||
418 | private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp, bool append) | 495 | private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool append) |
419 | { | 496 | { |
420 | // Add the new attachment to inventory if we don't already have it. | 497 | // Add the new attachment to inventory if we don't already have it. |
421 | if (!temp) | 498 | UUID newAttachmentItemID = group.FromItemID; |
422 | { | 499 | if (newAttachmentItemID == UUID.Zero) |
423 | UUID newAttachmentItemID = group.FromItemID; | 500 | newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID; |
424 | if (newAttachmentItemID == UUID.Zero) | ||
425 | newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID; | ||
426 | 501 | ||
427 | ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group, append); | 502 | ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group, append); |
428 | } | ||
429 | } | 503 | } |
430 | 504 | ||
431 | public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt) | 505 | public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt) |
@@ -438,40 +512,40 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
438 | if (!Enabled) | 512 | if (!Enabled) |
439 | return null; | 513 | return null; |
440 | 514 | ||
441 | // m_log.DebugFormat( | 515 | if (DebugLevel > 0) |
442 | // "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2} in {3}", | 516 | m_log.DebugFormat( |
443 | // (AttachmentPoint)AttachmentPt, itemID, sp.Name, m_scene.Name); | 517 | "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2} in {3}", |
444 | 518 | (AttachmentPoint)AttachmentPt, itemID, sp.Name, m_scene.Name); | |
445 | bool append = (AttachmentPt & 0x80) != 0; | ||
446 | AttachmentPt &= 0x7f; | ||
447 | 519 | ||
448 | // Viewer 2/3 sometimes asks to re-wear items that are already worn (and show up in it's inventory as such). | 520 | // We check the attachments in the avatar appearance here rather than the objects attached to the |
449 | // This often happens during login - not sure the exact reason. | 521 | // ScenePresence itself so that we can ignore calls by viewer 2/3 to attach objects on startup. We are |
450 | // For now, we will ignore the request. Unfortunately, this means that we need to dig through all the | 522 | // already doing this in ScenePresence.MakeRootAgent(). Simulator-side attaching needs to be done |
451 | // ScenePresence attachments. We can't use the data in AvatarAppearance because that's present at login | 523 | // because pre-outfit folder viewers (most version 1 viewers) require it. |
452 | // before anything has actually been attached. | ||
453 | bool alreadyOn = false; | 524 | bool alreadyOn = false; |
454 | List<SceneObjectGroup> existingAttachments = sp.GetAttachments(); | 525 | List<AvatarAttachment> existingAttachments = sp.Appearance.GetAttachments(); |
455 | foreach (SceneObjectGroup so in existingAttachments) | 526 | foreach (AvatarAttachment existingAttachment in existingAttachments) |
456 | { | 527 | { |
457 | if (so.FromItemID == itemID) | 528 | if (existingAttachment.ItemID == itemID) |
458 | { | 529 | { |
459 | alreadyOn = true; | 530 | alreadyOn = true; |
460 | break; | 531 | break; |
461 | } | 532 | } |
462 | } | 533 | } |
463 | 534 | ||
464 | // if (sp.Appearance.GetAttachmentForItem(itemID) != null) | ||
465 | if (alreadyOn) | 535 | if (alreadyOn) |
466 | { | 536 | { |
467 | // m_log.WarnFormat( | 537 | if (DebugLevel > 0) |
468 | // "[ATTACHMENTS MODULE]: Ignoring request by {0} to wear item {1} at {2} since it is already worn", | 538 | m_log.DebugFormat( |
469 | // sp.Name, itemID, AttachmentPt); | 539 | "[ATTACHMENTS MODULE]: Ignoring request by {0} to wear item {1} at {2} since it is already worn", |
540 | sp.Name, itemID, AttachmentPt); | ||
470 | 541 | ||
471 | return null; | 542 | return null; |
472 | } | 543 | } |
473 | 544 | ||
474 | return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc, append); | 545 | bool append = (AttachmentPt & 0x80) != 0; |
546 | AttachmentPt &= 0x7f; | ||
547 | |||
548 | return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, append, doc); | ||
475 | } | 549 | } |
476 | 550 | ||
477 | public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist) | 551 | public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist) |
@@ -479,7 +553,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
479 | if (!Enabled) | 553 | if (!Enabled) |
480 | return; | 554 | return; |
481 | 555 | ||
482 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name); | 556 | if (DebugLevel > 0) |
557 | m_log.DebugFormat( | ||
558 | "[ATTACHMENTS MODULE]: Rezzing {0} attachments from inventory for {1} in {2}", | ||
559 | rezlist.Count, sp.Name, m_scene.Name); | ||
483 | 560 | ||
484 | foreach (KeyValuePair<UUID, uint> rez in rezlist) | 561 | foreach (KeyValuePair<UUID, uint> rez in rezlist) |
485 | { | 562 | { |
@@ -497,9 +574,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
497 | if (!Enabled) | 574 | if (!Enabled) |
498 | return; | 575 | return; |
499 | 576 | ||
500 | // m_log.DebugFormat( | 577 | if (DebugLevel > 0) |
501 | // "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", | 578 | m_log.DebugFormat( |
502 | // sp.UUID, soLocalId); | 579 | "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", |
580 | sp.UUID, soLocalId); | ||
503 | 581 | ||
504 | SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId); | 582 | SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId); |
505 | 583 | ||
@@ -515,9 +593,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
515 | if (inventoryID == UUID.Zero) | 593 | if (inventoryID == UUID.Zero) |
516 | return; | 594 | return; |
517 | 595 | ||
518 | // m_log.DebugFormat( | 596 | if (DebugLevel > 0) |
519 | // "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}", | 597 | m_log.DebugFormat( |
520 | // so.Name, so.LocalId, inventoryID); | 598 | "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}", |
599 | so.Name, so.LocalId, inventoryID); | ||
521 | 600 | ||
522 | lock (sp.AttachmentsSyncLock) | 601 | lock (sp.AttachmentsSyncLock) |
523 | { | 602 | { |
@@ -572,9 +651,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
572 | return; | 651 | return; |
573 | } | 652 | } |
574 | 653 | ||
575 | // m_log.DebugFormat( | 654 | if (DebugLevel > 0) |
576 | // "[ATTACHMENTS MODULE]: Detaching object {0} {1} (FromItemID {2}) for {3} in {4}", | 655 | m_log.DebugFormat( |
577 | // so.Name, so.LocalId, so.FromItemID, sp.Name, m_scene.Name); | 656 | "[ATTACHMENTS MODULE]: Detaching object {0} {1} (FromItemID {2}) for {3} in {4}", |
657 | so.Name, so.LocalId, so.FromItemID, sp.Name, m_scene.Name); | ||
578 | 658 | ||
579 | // Scripts MUST be snapshotted before the object is | 659 | // Scripts MUST be snapshotted before the object is |
580 | // removed from the scene because doing otherwise will | 660 | // removed from the scene because doing otherwise will |
@@ -700,12 +780,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
700 | 780 | ||
701 | grp.HasGroupChanged = false; // Prevent it being saved over and over | 781 | grp.HasGroupChanged = false; // Prevent it being saved over and over |
702 | } | 782 | } |
703 | // else | 783 | else if (DebugLevel > 0) |
704 | // { | 784 | { |
705 | // m_log.DebugFormat( | 785 | m_log.DebugFormat( |
706 | // "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}", | 786 | "[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}", |
707 | // grp.UUID, grp.AttachmentPoint); | 787 | grp.UUID, grp.AttachmentPoint); |
708 | // } | 788 | } |
709 | } | 789 | } |
710 | 790 | ||
711 | /// <summary> | 791 | /// <summary> |
@@ -723,9 +803,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
723 | private void AttachToAgent( | 803 | private void AttachToAgent( |
724 | IScenePresence sp, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) | 804 | IScenePresence sp, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) |
725 | { | 805 | { |
726 | // m_log.DebugFormat( | 806 | if (DebugLevel > 0) |
727 | // "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", | 807 | m_log.DebugFormat( |
728 | // so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); | 808 | "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", |
809 | so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); | ||
729 | 810 | ||
730 | so.DetachFromBackup(); | 811 | so.DetachFromBackup(); |
731 | 812 | ||
@@ -750,9 +831,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
750 | { | 831 | { |
751 | if (so.HasPrivateAttachmentPoint) | 832 | if (so.HasPrivateAttachmentPoint) |
752 | { | 833 | { |
753 | // m_log.DebugFormat( | 834 | if (DebugLevel > 0) |
754 | // "[ATTACHMENTS MODULE]: Killing private HUD {0} for avatars other than {1} at attachment point {2}", | 835 | m_log.DebugFormat( |
755 | // so.Name, sp.Name, so.AttachmentPoint); | 836 | "[ATTACHMENTS MODULE]: Killing private HUD {0} for avatars other than {1} at attachment point {2}", |
837 | so.Name, sp.Name, so.AttachmentPoint); | ||
756 | 838 | ||
757 | // As this scene object can now only be seen by the attaching avatar, tell everybody else in the | 839 | // As this scene object can now only be seen by the attaching avatar, tell everybody else in the |
758 | // scene that it's no longer in their awareness. | 840 | // scene that it's no longer in their awareness. |
@@ -786,9 +868,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
786 | if (m_invAccessModule == null) | 868 | if (m_invAccessModule == null) |
787 | return null; | 869 | return null; |
788 | 870 | ||
789 | // m_log.DebugFormat( | 871 | if (DebugLevel > 0) |
790 | // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", | 872 | m_log.DebugFormat( |
791 | // grp.Name, grp.LocalId, remoteClient.Name); | 873 | "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", |
874 | grp.Name, grp.LocalId, sp.Name); | ||
792 | 875 | ||
793 | InventoryItemBase newItem | 876 | InventoryItemBase newItem |
794 | = m_invAccessModule.CopyToInventory( | 877 | = m_invAccessModule.CopyToInventory( |
@@ -872,7 +955,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
872 | } | 955 | } |
873 | 956 | ||
874 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 957 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
875 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc, bool append) | 958 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, bool append, XmlDocument doc) |
876 | { | 959 | { |
877 | if (m_invAccessModule == null) | 960 | if (m_invAccessModule == null) |
878 | return null; | 961 | return null; |
@@ -897,6 +980,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
897 | return null; | 980 | return null; |
898 | } | 981 | } |
899 | 982 | ||
983 | if (DebugLevel > 0) | ||
984 | m_log.DebugFormat( | ||
985 | "[ATTACHMENTS MODULE]: Rezzed single object {0} for attachment to {1} on point {2} in {3}", | ||
986 | objatt.Name, sp.Name, attachmentPt, m_scene.Name); | ||
987 | |||
900 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. | 988 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. |
901 | objatt.HasGroupChanged = false; | 989 | objatt.HasGroupChanged = false; |
902 | bool tainted = false; | 990 | bool tainted = false; |
@@ -917,7 +1005,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
917 | objatt.ResetOwnerChangeFlag(); | 1005 | objatt.ResetOwnerChangeFlag(); |
918 | } | 1006 | } |
919 | 1007 | ||
920 | AttachObjectInternal(sp, objatt, attachmentPt, false, true, false, true, append); | 1008 | AttachObjectInternal(sp, objatt, attachmentPt, false, true, true, true, append); |
921 | } | 1009 | } |
922 | catch (Exception e) | 1010 | catch (Exception e) |
923 | { | 1011 | { |
@@ -971,9 +1059,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
971 | bool changed = sp.Appearance.SetAttachment((int)AttachmentPt | attFlag, itemID, item.AssetID); | 1059 | bool changed = sp.Appearance.SetAttachment((int)AttachmentPt | attFlag, itemID, item.AssetID); |
972 | if (changed && m_scene.AvatarFactory != null) | 1060 | if (changed && m_scene.AvatarFactory != null) |
973 | { | 1061 | { |
974 | // m_log.DebugFormat( | 1062 | if (DebugLevel > 0) |
975 | // "[ATTACHMENTS MODULE]: Queueing appearance save for {0}, attachment {1} point {2} in ShowAttachInUserInventory()", | 1063 | m_log.DebugFormat( |
976 | // sp.Name, att.Name, AttachmentPt); | 1064 | "[ATTACHMENTS MODULE]: Queueing appearance save for {0}, attachment {1} point {2} in ShowAttachInUserInventory()", |
1065 | sp.Name, att.Name, AttachmentPt); | ||
977 | 1066 | ||
978 | m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); | 1067 | m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); |
979 | } | 1068 | } |
@@ -988,9 +1077,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
988 | if (!Enabled) | 1077 | if (!Enabled) |
989 | return null; | 1078 | return null; |
990 | 1079 | ||
991 | // m_log.DebugFormat( | 1080 | if (DebugLevel > 0) |
992 | // "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", | 1081 | m_log.DebugFormat( |
993 | // (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); | 1082 | "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", |
1083 | (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); | ||
994 | 1084 | ||
995 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | 1085 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); |
996 | 1086 | ||
@@ -1021,9 +1111,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1021 | 1111 | ||
1022 | private void Client_OnObjectAttach(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) | 1112 | private void Client_OnObjectAttach(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) |
1023 | { | 1113 | { |
1024 | // m_log.DebugFormat( | 1114 | if (DebugLevel > 0) |
1025 | // "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", | 1115 | m_log.DebugFormat( |
1026 | // objectLocalID, remoteClient.Name, AttachmentPt, silent); | 1116 | "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", |
1117 | objectLocalID, remoteClient.Name, AttachmentPt, silent); | ||
1027 | 1118 | ||
1028 | if (!Enabled) | 1119 | if (!Enabled) |
1029 | return; | 1120 | return; |
@@ -1056,11 +1147,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1056 | AttachmentPt &= 0x7f; | 1147 | AttachmentPt &= 0x7f; |
1057 | 1148 | ||
1058 | // Calls attach with a Zero position | 1149 | // Calls attach with a Zero position |
1059 | if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true, false, append)) | 1150 | if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, false, false, append)) |
1060 | { | 1151 | { |
1061 | // m_log.Debug( | 1152 | if (DebugLevel > 0) |
1062 | // "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | 1153 | m_log.Debug( |
1063 | // + ", AttachmentPoint: " + AttachmentPt); | 1154 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId |
1155 | + ", AttachmentPoint: " + AttachmentPt); | ||
1064 | 1156 | ||
1065 | // Save avatar attachment information | 1157 | // Save avatar attachment information |
1066 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); | 1158 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index a8fe045..1a38619 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -130,7 +130,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
130 | config.AddConfig("Modules"); | 130 | config.AddConfig("Modules"); |
131 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); | 131 | config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); |
132 | 132 | ||
133 | modules.Add(new AttachmentsModule()); | 133 | AttachmentsModule attMod = new AttachmentsModule(); |
134 | attMod.DebugLevel = 1; | ||
135 | modules.Add(attMod); | ||
134 | modules.Add(new BasicInventoryAccessModule()); | 136 | modules.Add(new BasicInventoryAccessModule()); |
135 | } | 137 | } |
136 | 138 | ||
@@ -197,7 +199,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
197 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID); | 199 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID); |
198 | 200 | ||
199 | m_numberOfAttachEventsFired = 0; | 201 | m_numberOfAttachEventsFired = 0; |
200 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false, false); | 202 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false, false); |
201 | 203 | ||
202 | // Check status on scene presence | 204 | // Check status on scene presence |
203 | Assert.That(sp.HasAttachments(), Is.True); | 205 | Assert.That(sp.HasAttachments(), Is.True); |
@@ -244,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
244 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "att1", sp.UUID); | 246 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "att1", sp.UUID); |
245 | 247 | ||
246 | m_numberOfAttachEventsFired = 0; | 248 | m_numberOfAttachEventsFired = 0; |
247 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Default, false, false, false, false); | 249 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Default, false, true, false, false); |
248 | 250 | ||
249 | // Check status on scene presence | 251 | // Check status on scene presence |
250 | Assert.That(sp.HasAttachments(), Is.True); | 252 | Assert.That(sp.HasAttachments(), Is.True); |
@@ -277,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
277 | 279 | ||
278 | // Test wearing a different attachment from the ground. | 280 | // Test wearing a different attachment from the ground. |
279 | { | 281 | { |
280 | scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, false, false, false); | 282 | scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, true, false, false); |
281 | 283 | ||
282 | // Check status on scene presence | 284 | // Check status on scene presence |
283 | Assert.That(sp.HasAttachments(), Is.True); | 285 | Assert.That(sp.HasAttachments(), Is.True); |
@@ -310,7 +312,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
310 | 312 | ||
311 | // Test rewearing an already worn attachment from ground. Nothing should happen. | 313 | // Test rewearing an already worn attachment from ground. Nothing should happen. |
312 | { | 314 | { |
313 | scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, false, false, false); | 315 | scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, true, false, false); |
314 | 316 | ||
315 | // Check status on scene presence | 317 | // Check status on scene presence |
316 | Assert.That(sp.HasAttachments(), Is.True); | 318 | Assert.That(sp.HasAttachments(), Is.True); |
@@ -368,7 +370,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
368 | sp2.AbsolutePosition = new Vector3(0, 0, 0); | 370 | sp2.AbsolutePosition = new Vector3(0, 0, 0); |
369 | sp2.HandleAgentRequestSit(sp2.ControllingClient, sp2.UUID, so.UUID, Vector3.Zero); | 371 | sp2.HandleAgentRequestSit(sp2.ControllingClient, sp2.UUID, so.UUID, Vector3.Zero); |
370 | 372 | ||
371 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false, false); | 373 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false, false); |
372 | 374 | ||
373 | Assert.That(sp.HasAttachments(), Is.False); | 375 | Assert.That(sp.HasAttachments(), Is.False); |
374 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); | 376 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); |
@@ -728,7 +730,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
728 | public void TestRezAttachmentsOnAvatarEntrance() | 730 | public void TestRezAttachmentsOnAvatarEntrance() |
729 | { | 731 | { |
730 | TestHelpers.InMethod(); | 732 | TestHelpers.InMethod(); |
731 | // log4net.Config.XmlConfigurator.Configure(); | 733 | // TestHelpers.EnableLogging(); |
732 | 734 | ||
733 | Scene scene = CreateTestScene(); | 735 | Scene scene = CreateTestScene(); |
734 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 736 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs index 6c9fd86..a34f2d2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs | |||
@@ -154,7 +154,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
154 | 154 | ||
155 | void OnIncomingInstantMessage(GridInstantMessage im) | 155 | void OnIncomingInstantMessage(GridInstantMessage im) |
156 | { | 156 | { |
157 | if (im.dialog == (byte)InstantMessageDialog.RequestTeleport) | 157 | if (im.dialog == (byte)InstantMessageDialog.RequestTeleport |
158 | || im.dialog == (byte)InstantMessageDialog.GodLikeRequestTeleport) | ||
158 | { | 159 | { |
159 | UUID sessionID = new UUID(im.imSessionID); | 160 | UUID sessionID = new UUID(im.imSessionID); |
160 | 161 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index f3adb95..0c64f19 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -165,7 +165,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
165 | (uint)presence.AbsolutePosition.Y, | 165 | (uint)presence.AbsolutePosition.Y, |
166 | (uint)presence.AbsolutePosition.Z + 2); | 166 | (uint)presence.AbsolutePosition.Z + 2); |
167 | 167 | ||
168 | m_log.DebugFormat("[LURE]: TP invite with message {0}", message); | 168 | m_log.DebugFormat("TP invite with message {0}, type {1}", message, lureType); |
169 | 169 | ||
170 | GridInstantMessage m; | 170 | GridInstantMessage m; |
171 | 171 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 25334b9..8082c1b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -33,6 +33,7 @@ using System.Threading; | |||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Capabilities; | 34 | using OpenSim.Framework.Capabilities; |
35 | using OpenSim.Framework.Client; | 35 | using OpenSim.Framework.Client; |
36 | using OpenSim.Framework.Monitoring; | ||
36 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Region.Physics.Manager; | 39 | using OpenSim.Region.Physics.Manager; |
@@ -77,6 +78,31 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
77 | /// </remarks> | 78 | /// </remarks> |
78 | public bool DisableInterRegionTeleportCancellation { get; set; } | 79 | public bool DisableInterRegionTeleportCancellation { get; set; } |
79 | 80 | ||
81 | /// <summary> | ||
82 | /// Number of times inter-region teleport was attempted. | ||
83 | /// </summary> | ||
84 | private Stat m_interRegionTeleportAttempts; | ||
85 | |||
86 | /// <summary> | ||
87 | /// Number of times inter-region teleport was aborted (due to simultaneous client logout). | ||
88 | /// </summary> | ||
89 | private Stat m_interRegionTeleportAborts; | ||
90 | |||
91 | /// <summary> | ||
92 | /// Number of times inter-region teleport was successfully cancelled by the client. | ||
93 | /// </summary> | ||
94 | private Stat m_interRegionTeleportCancels; | ||
95 | |||
96 | /// <summary> | ||
97 | /// Number of times inter-region teleport failed due to server/client/network problems (e.g. viewer failed to | ||
98 | /// connect with destination region). | ||
99 | /// </summary> | ||
100 | /// <remarks> | ||
101 | /// This is not necessarily a problem for this simulator - in open-grid/hg conditions, viewer connectivity to | ||
102 | /// destination simulator is unknown. | ||
103 | /// </remarks> | ||
104 | private Stat m_interRegionTeleportFailures; | ||
105 | |||
80 | protected bool m_Enabled = false; | 106 | protected bool m_Enabled = false; |
81 | 107 | ||
82 | public Scene Scene { get; private set; } | 108 | public Scene Scene { get; private set; } |
@@ -91,6 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
91 | new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>(); | 117 | new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>(); |
92 | 118 | ||
93 | private IEventQueue m_eqModule; | 119 | private IEventQueue m_eqModule; |
120 | private IRegionCombinerModule m_regionCombinerModule; | ||
94 | 121 | ||
95 | #region ISharedRegionModule | 122 | #region ISharedRegionModule |
96 | 123 | ||
@@ -156,6 +183,60 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
156 | 183 | ||
157 | Scene = scene; | 184 | Scene = scene; |
158 | 185 | ||
186 | m_interRegionTeleportAttempts = | ||
187 | new Stat( | ||
188 | "InterRegionTeleportAttempts", | ||
189 | "Number of inter-region teleports attempted.", | ||
190 | "This does not count attempts which failed due to pre-conditions (e.g. target simulator refused access).\n" | ||
191 | + "You can get successfully teleports by subtracting aborts, cancels and teleport failures from this figure.", | ||
192 | "", | ||
193 | "entitytransfer", | ||
194 | Scene.Name, | ||
195 | StatType.Push, | ||
196 | null, | ||
197 | StatVerbosity.Debug); | ||
198 | |||
199 | m_interRegionTeleportAborts = | ||
200 | new Stat( | ||
201 | "InterRegionTeleportAborts", | ||
202 | "Number of inter-region teleports aborted due to client actions.", | ||
203 | "The chief action is simultaneous logout whilst teleporting.", | ||
204 | "", | ||
205 | "entitytransfer", | ||
206 | Scene.Name, | ||
207 | StatType.Push, | ||
208 | null, | ||
209 | StatVerbosity.Debug); | ||
210 | |||
211 | m_interRegionTeleportCancels = | ||
212 | new Stat( | ||
213 | "InterRegionTeleportCancels", | ||
214 | "Number of inter-region teleports cancelled by the client.", | ||
215 | null, | ||
216 | "", | ||
217 | "entitytransfer", | ||
218 | Scene.Name, | ||
219 | StatType.Push, | ||
220 | null, | ||
221 | StatVerbosity.Debug); | ||
222 | |||
223 | m_interRegionTeleportFailures = | ||
224 | new Stat( | ||
225 | "InterRegionTeleportFailures", | ||
226 | "Number of inter-region teleports that failed due to server/client/network issues.", | ||
227 | "This number may not be very helpful in open-grid/hg situations as the network connectivity/quality of destinations is uncontrollable.", | ||
228 | "", | ||
229 | "entitytransfer", | ||
230 | Scene.Name, | ||
231 | StatType.Push, | ||
232 | null, | ||
233 | StatVerbosity.Debug); | ||
234 | |||
235 | StatsManager.RegisterStat(m_interRegionTeleportAttempts); | ||
236 | StatsManager.RegisterStat(m_interRegionTeleportAborts); | ||
237 | StatsManager.RegisterStat(m_interRegionTeleportCancels); | ||
238 | StatsManager.RegisterStat(m_interRegionTeleportFailures); | ||
239 | |||
159 | scene.RegisterModuleInterface<IEntityTransferModule>(this); | 240 | scene.RegisterModuleInterface<IEntityTransferModule>(this); |
160 | scene.EventManager.OnNewClient += OnNewClient; | 241 | scene.EventManager.OnNewClient += OnNewClient; |
161 | } | 242 | } |
@@ -173,7 +254,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
173 | 254 | ||
174 | public virtual void Close() {} | 255 | public virtual void Close() {} |
175 | 256 | ||
176 | public virtual void RemoveRegion(Scene scene) {} | 257 | public virtual void RemoveRegion(Scene scene) |
258 | { | ||
259 | if (m_Enabled) | ||
260 | { | ||
261 | StatsManager.DeregisterStat(m_interRegionTeleportAttempts); | ||
262 | StatsManager.DeregisterStat(m_interRegionTeleportAborts); | ||
263 | StatsManager.DeregisterStat(m_interRegionTeleportCancels); | ||
264 | StatsManager.DeregisterStat(m_interRegionTeleportFailures); | ||
265 | } | ||
266 | } | ||
177 | 267 | ||
178 | public virtual void RegionLoaded(Scene scene) | 268 | public virtual void RegionLoaded(Scene scene) |
179 | { | 269 | { |
@@ -181,6 +271,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
181 | return; | 271 | return; |
182 | 272 | ||
183 | m_eqModule = Scene.RequestModuleInterface<IEventQueue>(); | 273 | m_eqModule = Scene.RequestModuleInterface<IEventQueue>(); |
274 | m_regionCombinerModule = Scene.RequestModuleInterface<IRegionCombinerModule>(); | ||
184 | } | 275 | } |
185 | 276 | ||
186 | #endregion | 277 | #endregion |
@@ -291,8 +382,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
291 | Vector3 emergencyPos = new Vector3(128, 128, 128); | 382 | Vector3 emergencyPos = new Vector3(128, 128, 128); |
292 | 383 | ||
293 | m_log.WarnFormat( | 384 | m_log.WarnFormat( |
294 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", | 385 | "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2} in {3}. Substituting {4}", |
295 | position, sp.Name, sp.UUID, emergencyPos); | 386 | position, sp.Name, sp.UUID, Scene.Name, emergencyPos); |
296 | 387 | ||
297 | position = emergencyPos; | 388 | position = emergencyPos; |
298 | } | 389 | } |
@@ -548,6 +639,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
548 | return; | 639 | return; |
549 | } | 640 | } |
550 | 641 | ||
642 | // Before this point, teleport 'failure' is due to checkable pre-conditions such as whether the target | ||
643 | // simulator can be found and is explicitly prepared to allow access. Therefore, we will not count these | ||
644 | // as server attempts. | ||
645 | m_interRegionTeleportAttempts.Value++; | ||
646 | |||
551 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); | 647 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); |
552 | 648 | ||
553 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 649 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
@@ -600,6 +696,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
600 | bool logout = false; | 696 | bool logout = false; |
601 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) | 697 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) |
602 | { | 698 | { |
699 | m_interRegionTeleportFailures.Value++; | ||
700 | |||
603 | sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason)); | 701 | sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason)); |
604 | 702 | ||
605 | m_log.DebugFormat( | 703 | m_log.DebugFormat( |
@@ -611,6 +709,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
611 | 709 | ||
612 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling) | 710 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling) |
613 | { | 711 | { |
712 | m_interRegionTeleportCancels.Value++; | ||
713 | |||
614 | m_log.DebugFormat( | 714 | m_log.DebugFormat( |
615 | "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request", | 715 | "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request", |
616 | sp.Name, finalDestination.RegionName, sp.Scene.Name); | 716 | sp.Name, finalDestination.RegionName, sp.Scene.Name); |
@@ -619,6 +719,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
619 | } | 719 | } |
620 | else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) | 720 | else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) |
621 | { | 721 | { |
722 | m_interRegionTeleportAborts.Value++; | ||
723 | |||
622 | m_log.DebugFormat( | 724 | m_log.DebugFormat( |
623 | "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.", | 725 | "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.", |
624 | sp.Name, finalDestination.RegionName, sp.Scene.Name); | 726 | sp.Name, finalDestination.RegionName, sp.Scene.Name); |
@@ -635,6 +737,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
635 | IClientIPEndpoint ipepClient; | 737 | IClientIPEndpoint ipepClient; |
636 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | 738 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) |
637 | { | 739 | { |
740 | m_log.DebugFormat( | ||
741 | "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for incoming agent {3} from {4}", | ||
742 | finalDestination.RegionName, newRegionX, newRegionY, sp.Name, Scene.Name); | ||
743 | |||
638 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); | 744 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); |
639 | #region IP Translation for NAT | 745 | #region IP Translation for NAT |
640 | // Uses ipepClient above | 746 | // Uses ipepClient above |
@@ -688,6 +794,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
688 | // establish th econnection to the destination which makes it return true. | 794 | // establish th econnection to the destination which makes it return true. |
689 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) | 795 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) |
690 | { | 796 | { |
797 | m_interRegionTeleportAborts.Value++; | ||
798 | |||
691 | m_log.DebugFormat( | 799 | m_log.DebugFormat( |
692 | "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} before UpdateAgent", | 800 | "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} before UpdateAgent", |
693 | sp.Name, finalDestination.RegionName, sp.Scene.Name); | 801 | sp.Name, finalDestination.RegionName, sp.Scene.Name); |
@@ -703,6 +811,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
703 | { | 811 | { |
704 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) | 812 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) |
705 | { | 813 | { |
814 | m_interRegionTeleportAborts.Value++; | ||
815 | |||
706 | m_log.DebugFormat( | 816 | m_log.DebugFormat( |
707 | "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.", | 817 | "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.", |
708 | sp.Name, finalDestination.RegionName, sp.Scene.Name); | 818 | sp.Name, finalDestination.RegionName, sp.Scene.Name); |
@@ -720,6 +830,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
720 | 830 | ||
721 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling) | 831 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling) |
722 | { | 832 | { |
833 | m_interRegionTeleportCancels.Value++; | ||
834 | |||
723 | m_log.DebugFormat( | 835 | m_log.DebugFormat( |
724 | "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request", | 836 | "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request", |
725 | sp.Name, finalDestination.RegionName, sp.Scene.Name); | 837 | sp.Name, finalDestination.RegionName, sp.Scene.Name); |
@@ -755,6 +867,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
755 | { | 867 | { |
756 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) | 868 | if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) |
757 | { | 869 | { |
870 | m_interRegionTeleportAborts.Value++; | ||
871 | |||
758 | m_log.DebugFormat( | 872 | m_log.DebugFormat( |
759 | "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after WaitForAgentArrivedAtDestination due to previous client close.", | 873 | "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after WaitForAgentArrivedAtDestination due to previous client close.", |
760 | sp.Name, finalDestination.RegionName, sp.Scene.Name); | 874 | sp.Name, finalDestination.RegionName, sp.Scene.Name); |
@@ -767,6 +881,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
767 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); | 881 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
768 | 882 | ||
769 | Fail(sp, finalDestination, logout, "Destination region did not signal teleport completion."); | 883 | Fail(sp, finalDestination, logout, "Destination region did not signal teleport completion."); |
884 | |||
770 | return; | 885 | return; |
771 | } | 886 | } |
772 | 887 | ||
@@ -808,15 +923,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
808 | // now we have a child agent in this region. | 923 | // now we have a child agent in this region. |
809 | sp.Reset(); | 924 | sp.Reset(); |
810 | } | 925 | } |
811 | |||
812 | // Commented pending deletion since this method no longer appears to do anything at all | ||
813 | // // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
814 | // if (sp.Scene.NeedSceneCacheClear(sp.UUID)) | ||
815 | // { | ||
816 | // m_log.DebugFormat( | ||
817 | // "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", | ||
818 | // sp.UUID); | ||
819 | // } | ||
820 | } | 926 | } |
821 | 927 | ||
822 | /// <summary> | 928 | /// <summary> |
@@ -852,6 +958,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
852 | { | 958 | { |
853 | CleanupFailedInterRegionTeleport(sp, finalDestination); | 959 | CleanupFailedInterRegionTeleport(sp, finalDestination); |
854 | 960 | ||
961 | m_interRegionTeleportFailures.Value++; | ||
962 | |||
855 | sp.ControllingClient.SendTeleportFailed( | 963 | sp.ControllingClient.SendTeleportFailed( |
856 | string.Format( | 964 | string.Format( |
857 | "Problems connecting to destination {0}, reason: {1}", finalDestination.RegionName, reason)); | 965 | "Problems connecting to destination {0}, reason: {1}", finalDestination.RegionName, reason)); |
@@ -907,7 +1015,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
907 | 1015 | ||
908 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) | 1016 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) |
909 | { | 1017 | { |
910 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); | 1018 | if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) |
1019 | { | ||
1020 | Vector2 swCorner, neCorner; | ||
1021 | GetMegaregionViewRange(out swCorner, out neCorner); | ||
1022 | |||
1023 | m_log.DebugFormat( | ||
1024 | "[ENTITY TRANSFER MODULE]: Megaregion view of {0} is from {1} to {2} with new agent check for {3},{4}", | ||
1025 | Scene.Name, swCorner, neCorner, newRegionX, newRegionY); | ||
1026 | |||
1027 | return !(newRegionX >= swCorner.X && newRegionX <= neCorner.X && newRegionY >= swCorner.Y && newRegionY <= neCorner.Y); | ||
1028 | } | ||
1029 | else | ||
1030 | { | ||
1031 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); | ||
1032 | } | ||
911 | } | 1033 | } |
912 | 1034 | ||
913 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 1035 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) |
@@ -1011,6 +1133,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1011 | { | 1133 | { |
1012 | version = String.Empty; | 1134 | version = String.Empty; |
1013 | newpos = new Vector3(pos.X, pos.Y, pos.Z); | 1135 | newpos = new Vector3(pos.X, pos.Y, pos.Z); |
1136 | |||
1137 | // m_log.DebugFormat( | ||
1138 | // "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name); | ||
1139 | |||
1014 | uint neighbourx = scene.RegionInfo.RegionLocX; | 1140 | uint neighbourx = scene.RegionInfo.RegionLocX; |
1015 | uint neighboury = scene.RegionInfo.RegionLocY; | 1141 | uint neighboury = scene.RegionInfo.RegionLocY; |
1016 | const float boundaryDistance = 1.7f; | 1142 | const float boundaryDistance = 1.7f; |
@@ -1182,7 +1308,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1182 | Scene initiatingScene) | 1308 | Scene initiatingScene) |
1183 | { | 1309 | { |
1184 | Thread.Sleep(10000); | 1310 | Thread.Sleep(10000); |
1185 | 1311 | ||
1312 | m_log.DebugFormat( | ||
1313 | "[ENTITY TRANSFER MODULE]: Auto-reteleporting {0} to correct megaregion location {1},{2},{3} from {4}", | ||
1314 | agent.Name, regionX, regionY, position, initiatingScene.Name); | ||
1315 | |||
1316 | agent.Scene.RequestTeleportLocation( | ||
1317 | agent.ControllingClient, | ||
1318 | Utils.UIntsToLong(regionX * (uint)Constants.RegionSize, regionY * (uint)Constants.RegionSize), | ||
1319 | position, | ||
1320 | agent.Lookat, | ||
1321 | (uint)Constants.TeleportFlags.ViaLocation); | ||
1322 | |||
1323 | /* | ||
1186 | IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>(); | 1324 | IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>(); |
1187 | if (im != null) | 1325 | if (im != null) |
1188 | { | 1326 | { |
@@ -1217,6 +1355,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1217 | }); | 1355 | }); |
1218 | 1356 | ||
1219 | } | 1357 | } |
1358 | */ | ||
1220 | } | 1359 | } |
1221 | 1360 | ||
1222 | private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar) | 1361 | private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar) |
@@ -1725,6 +1864,37 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1725 | } | 1864 | } |
1726 | 1865 | ||
1727 | /// <summary> | 1866 | /// <summary> |
1867 | /// Gets the range considered in view of this megaregion (assuming this is a megaregion). | ||
1868 | /// </summary> | ||
1869 | /// <remarks>Expressed in 256m units</remarks> | ||
1870 | /// <param name='swCorner'></param> | ||
1871 | /// <param name='neCorner'></param> | ||
1872 | private void GetMegaregionViewRange(out Vector2 swCorner, out Vector2 neCorner) | ||
1873 | { | ||
1874 | Border[] northBorders = Scene.NorthBorders.ToArray(); | ||
1875 | Border[] eastBorders = Scene.EastBorders.ToArray(); | ||
1876 | |||
1877 | Vector2 extent = Vector2.Zero; | ||
1878 | for (int i = 0; i < eastBorders.Length; i++) | ||
1879 | { | ||
1880 | extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X; | ||
1881 | } | ||
1882 | for (int i = 0; i < northBorders.Length; i++) | ||
1883 | { | ||
1884 | extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y; | ||
1885 | } | ||
1886 | |||
1887 | // Loss of fraction on purpose | ||
1888 | extent.X = ((int)extent.X / (int)Constants.RegionSize); | ||
1889 | extent.Y = ((int)extent.Y / (int)Constants.RegionSize); | ||
1890 | |||
1891 | swCorner.X = Scene.RegionInfo.RegionLocX - 1; | ||
1892 | swCorner.Y = Scene.RegionInfo.RegionLocY - 1; | ||
1893 | neCorner.X = Scene.RegionInfo.RegionLocX + extent.X; | ||
1894 | neCorner.Y = Scene.RegionInfo.RegionLocY + extent.Y; | ||
1895 | } | ||
1896 | |||
1897 | /// <summary> | ||
1728 | /// Return the list of regions that are considered to be neighbours to the given scene. | 1898 | /// Return the list of regions that are considered to be neighbours to the given scene. |
1729 | /// </summary> | 1899 | /// </summary> |
1730 | /// <param name="pScene"></param> | 1900 | /// <param name="pScene"></param> |
@@ -1736,15 +1906,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1736 | Scene pScene = avatar.Scene; | 1906 | Scene pScene = avatar.Scene; |
1737 | RegionInfo m_regionInfo = pScene.RegionInfo; | 1907 | RegionInfo m_regionInfo = pScene.RegionInfo; |
1738 | 1908 | ||
1739 | Border[] northBorders = pScene.NorthBorders.ToArray(); | ||
1740 | Border[] southBorders = pScene.SouthBorders.ToArray(); | ||
1741 | Border[] eastBorders = pScene.EastBorders.ToArray(); | ||
1742 | Border[] westBorders = pScene.WestBorders.ToArray(); | ||
1743 | |||
1744 | // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't | 1909 | // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't |
1745 | // clear what should be done with a "far view" given that megaregions already extended the | 1910 | // clear what should be done with a "far view" given that megaregions already extended the |
1746 | // view to include everything in the megaregion | 1911 | // view to include everything in the megaregion |
1747 | if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) | 1912 | if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) |
1748 | { | 1913 | { |
1749 | int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance; | 1914 | int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance; |
1750 | 1915 | ||
@@ -1762,27 +1927,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1762 | } | 1927 | } |
1763 | else | 1928 | else |
1764 | { | 1929 | { |
1765 | Vector2 extent = Vector2.Zero; | 1930 | Vector2 swCorner, neCorner; |
1766 | for (int i = 0; i < eastBorders.Length; i++) | 1931 | GetMegaregionViewRange(out swCorner, out neCorner); |
1767 | { | ||
1768 | extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X; | ||
1769 | } | ||
1770 | for (int i = 0; i < northBorders.Length; i++) | ||
1771 | { | ||
1772 | extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y; | ||
1773 | } | ||
1774 | |||
1775 | // Loss of fraction on purpose | ||
1776 | extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1; | ||
1777 | extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1; | ||
1778 | |||
1779 | int startX = (int)(pRegionLocX - 1) * (int)Constants.RegionSize; | ||
1780 | int startY = (int)(pRegionLocY - 1) * (int)Constants.RegionSize; | ||
1781 | 1932 | ||
1782 | int endX = ((int)pRegionLocX + (int)extent.X) * (int)Constants.RegionSize; | 1933 | List<GridRegion> neighbours |
1783 | int endY = ((int)pRegionLocY + (int)extent.Y) * (int)Constants.RegionSize; | 1934 | = pScene.GridService.GetRegionRange( |
1935 | m_regionInfo.ScopeID, | ||
1936 | (int)swCorner.X * (int)Constants.RegionSize, | ||
1937 | (int)neCorner.X * (int)Constants.RegionSize, | ||
1938 | (int)swCorner.Y * (int)Constants.RegionSize, | ||
1939 | (int)neCorner.Y * (int)Constants.RegionSize); | ||
1784 | 1940 | ||
1785 | List<GridRegion> neighbours = pScene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY); | ||
1786 | neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); | 1941 | neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); |
1787 | 1942 | ||
1788 | return neighbours; | 1943 | return neighbours; |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 9b78b3b..d372c0e 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -199,7 +199,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
199 | 199 | ||
200 | public override void RemoveRegion(Scene scene) | 200 | public override void RemoveRegion(Scene scene) |
201 | { | 201 | { |
202 | base.AddRegion(scene); | 202 | base.RemoveRegion(scene); |
203 | 203 | ||
204 | if (m_Enabled) | 204 | if (m_Enabled) |
205 | scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); | 205 | scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 0276267..2b13a8b 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -189,6 +189,45 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
189 | case (int)HttpRequestConstants.HTTP_VERIFY_CERT: | 189 | case (int)HttpRequestConstants.HTTP_VERIFY_CERT: |
190 | htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0); | 190 | htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0); |
191 | break; | 191 | break; |
192 | |||
193 | case (int)HttpRequestConstants.HTTP_VERBOSE_THROTTLE: | ||
194 | |||
195 | // TODO implement me | ||
196 | break; | ||
197 | |||
198 | case (int)HttpRequestConstants.HTTP_CUSTOM_HEADER: | ||
199 | //Parameters are in pairs and custom header takes | ||
200 | //arguments in pairs so adjust for header marker. | ||
201 | ++i; | ||
202 | |||
203 | //Maximum of 8 headers are allowed based on the | ||
204 | //Second Life documentation for llHTTPRequest. | ||
205 | for (int count = 1; count <= 8; ++count) | ||
206 | { | ||
207 | //Not enough parameters remaining for a header? | ||
208 | if (parms.Length - i < 2) | ||
209 | break; | ||
210 | |||
211 | //Have we reached the end of the list of headers? | ||
212 | //End is marked by a string with a single digit. | ||
213 | //We already know we have at least one parameter | ||
214 | //so it is safe to do this check at top of loop. | ||
215 | if (Char.IsDigit(parms[i][0])) | ||
216 | break; | ||
217 | |||
218 | if (htc.HttpCustomHeaders == null) | ||
219 | htc.HttpCustomHeaders = new List<string>(); | ||
220 | |||
221 | htc.HttpCustomHeaders.Add(parms[i]); | ||
222 | htc.HttpCustomHeaders.Add(parms[i+1]); | ||
223 | |||
224 | i += 2; | ||
225 | } | ||
226 | break; | ||
227 | |||
228 | case (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE: | ||
229 | htc.HttpPragmaNoCache = (int.Parse(parms[i + 1]) != 0); | ||
230 | break; | ||
192 | } | 231 | } |
193 | } | 232 | } |
194 | } | 233 | } |
@@ -353,9 +392,12 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
353 | // public const int HTTP_METHOD = 0; | 392 | // public const int HTTP_METHOD = 0; |
354 | // public const int HTTP_MIMETYPE = 1; | 393 | // public const int HTTP_MIMETYPE = 1; |
355 | // public const int HTTP_VERIFY_CERT = 3; | 394 | // public const int HTTP_VERIFY_CERT = 3; |
395 | // public const int HTTP_VERBOSE_THROTTLE = 4; | ||
396 | // public const int HTTP_CUSTOM_HEADER = 5; | ||
397 | // public const int HTTP_PRAGMA_NO_CACHE = 6; | ||
356 | private bool _finished; | 398 | private bool _finished; |
357 | public bool Finished | 399 | public bool Finished |
358 | { | 400 | { |
359 | get { return _finished; } | 401 | get { return _finished; } |
360 | } | 402 | } |
361 | // public int HttpBodyMaxLen = 2048; // not implemented | 403 | // public int HttpBodyMaxLen = 2048; // not implemented |
@@ -367,9 +409,14 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
367 | public bool HttpVerifyCert = true; | 409 | public bool HttpVerifyCert = true; |
368 | public IWorkItemResult WorkItem = null; | 410 | public IWorkItemResult WorkItem = null; |
369 | 411 | ||
412 | //public bool HttpVerboseThrottle = true; // not implemented | ||
413 | public List<string> HttpCustomHeaders = null; | ||
414 | public bool HttpPragmaNoCache = true; | ||
415 | private Thread httpThread; | ||
416 | |||
370 | // Request info | 417 | // Request info |
371 | private UUID _itemID; | 418 | private UUID _itemID; |
372 | public UUID ItemID | 419 | public UUID ItemID |
373 | { | 420 | { |
374 | get { return _itemID; } | 421 | get { return _itemID; } |
375 | set { _itemID = value; } | 422 | set { _itemID = value; } |
@@ -385,7 +432,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
385 | public string proxyexcepts; | 432 | public string proxyexcepts; |
386 | public string OutboundBody; | 433 | public string OutboundBody; |
387 | private UUID _reqID; | 434 | private UUID _reqID; |
388 | public UUID ReqID | 435 | public UUID ReqID |
389 | { | 436 | { |
390 | get { return _reqID; } | 437 | get { return _reqID; } |
391 | set { _reqID = value; } | 438 | set { _reqID = value; } |
@@ -434,20 +481,34 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
434 | Request.Method = HttpMethod; | 481 | Request.Method = HttpMethod; |
435 | Request.ContentType = HttpMIMEType; | 482 | Request.ContentType = HttpMIMEType; |
436 | 483 | ||
437 | if(!HttpVerifyCert) | 484 | if (!HttpVerifyCert) |
438 | { | 485 | { |
439 | // We could hijack Connection Group Name to identify | 486 | // We could hijack Connection Group Name to identify |
440 | // a desired security exception. But at the moment we'll use a dummy header instead. | 487 | // a desired security exception. But at the moment we'll use a dummy header instead. |
441 | Request.Headers.Add("NoVerifyCert", "true"); | 488 | Request.Headers.Add("NoVerifyCert", "true"); |
442 | } | 489 | } |
443 | if (proxyurl != null && proxyurl.Length > 0) | 490 | // else |
491 | // { | ||
492 | // Request.ConnectionGroupName="Verify"; | ||
493 | // } | ||
494 | if (!HttpPragmaNoCache) | ||
495 | { | ||
496 | Request.Headers.Add("Pragma", "no-cache"); | ||
497 | } | ||
498 | if (HttpCustomHeaders != null) | ||
444 | { | 499 | { |
445 | if (proxyexcepts != null && proxyexcepts.Length > 0) | 500 | for (int i = 0; i < HttpCustomHeaders.Count; i += 2) |
501 | Request.Headers.Add(HttpCustomHeaders[i], | ||
502 | HttpCustomHeaders[i+1]); | ||
503 | } | ||
504 | if (proxyurl != null && proxyurl.Length > 0) | ||
505 | { | ||
506 | if (proxyexcepts != null && proxyexcepts.Length > 0) | ||
446 | { | 507 | { |
447 | string[] elist = proxyexcepts.Split(';'); | 508 | string[] elist = proxyexcepts.Split(';'); |
448 | Request.Proxy = new WebProxy(proxyurl, true, elist); | 509 | Request.Proxy = new WebProxy(proxyurl, true, elist); |
449 | } | 510 | } |
450 | else | 511 | else |
451 | { | 512 | { |
452 | Request.Proxy = new WebProxy(proxyurl, true); | 513 | Request.Proxy = new WebProxy(proxyurl, true); |
453 | } | 514 | } |
@@ -460,7 +521,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
460 | Request.Headers[entry.Key] = entry.Value; | 521 | Request.Headers[entry.Key] = entry.Value; |
461 | 522 | ||
462 | // Encode outbound data | 523 | // Encode outbound data |
463 | if (OutboundBody.Length > 0) | 524 | if (OutboundBody.Length > 0) |
464 | { | 525 | { |
465 | byte[] data = Util.UTF8.GetBytes(OutboundBody); | 526 | byte[] data = Util.UTF8.GetBytes(OutboundBody); |
466 | 527 | ||
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index 28db407..e434b2e 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -597,6 +597,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
597 | cdl.AddRow("LightFalloff", s.LightFalloff); | 597 | cdl.AddRow("LightFalloff", s.LightFalloff); |
598 | cdl.AddRow("LightIntensity", s.LightIntensity); | 598 | cdl.AddRow("LightIntensity", s.LightIntensity); |
599 | cdl.AddRow("LightRadius", s.LightRadius); | 599 | cdl.AddRow("LightRadius", s.LightRadius); |
600 | cdl.AddRow("Location (relative)", sop.RelativePosition); | ||
600 | cdl.AddRow("Media", string.Format("{0} entries", s.Media != null ? s.Media.Count.ToString() : "n/a")); | 601 | cdl.AddRow("Media", string.Format("{0} entries", s.Media != null ? s.Media.Count.ToString() : "n/a")); |
601 | cdl.AddRow("PathBegin", s.PathBegin); | 602 | cdl.AddRow("PathBegin", s.PathBegin); |
602 | cdl.AddRow("PathEnd", s.PathEnd); | 603 | cdl.AddRow("PathEnd", s.PathEnd); |
@@ -619,6 +620,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
619 | cdl.AddRow("ProjectionFocus", s.ProjectionFocus); | 620 | cdl.AddRow("ProjectionFocus", s.ProjectionFocus); |
620 | cdl.AddRow("ProjectionFOV", s.ProjectionFOV); | 621 | cdl.AddRow("ProjectionFOV", s.ProjectionFOV); |
621 | cdl.AddRow("ProjectionTextureUUID", s.ProjectionTextureUUID); | 622 | cdl.AddRow("ProjectionTextureUUID", s.ProjectionTextureUUID); |
623 | cdl.AddRow("Rotation (Relative)", sop.RotationOffset); | ||
624 | cdl.AddRow("Rotation (World)", sop.GetWorldRotation()); | ||
622 | cdl.AddRow("Scale", s.Scale); | 625 | cdl.AddRow("Scale", s.Scale); |
623 | cdl.AddRow( | 626 | cdl.AddRow( |
624 | "SculptData", | 627 | "SculptData", |