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/Avatar | |
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 'OpenSim/Region/CoreModules/Avatar')
4 files changed, 193 insertions, 98 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 | ||