aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-03-28 23:57:35 +0000
committerJustin Clark-Casey (justincc)2013-03-28 23:57:35 +0000
commitc92654fb43f303da8e1623f9fff8a404aad72374 (patch)
tree0da006460864b09b78c89fca4fc74d88895a81db /OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
parentAdd "debug attachments" console command to allow highly verbose attachment lo... (diff)
downloadopensim-SC_OLD-c92654fb43f303da8e1623f9fff8a404aad72374.zip
opensim-SC_OLD-c92654fb43f303da8e1623f9fff8a404aad72374.tar.gz
opensim-SC_OLD-c92654fb43f303da8e1623f9fff8a404aad72374.tar.bz2
opensim-SC_OLD-c92654fb43f303da8e1623f9fff8a404aad72374.tar.xz
Stop attempts to update/add existing attachments in user inventory when teleporting between regions.
This appears to resolve issues on teleport where attachments disappear or become labelled as invalid within user inventory.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs31
1 files changed, 15 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index c78f5b3..b7f4303 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -322,12 +322,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
322 sp.ClearAttachments(); 322 sp.ClearAttachments();
323 } 323 }
324 324
325 public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool temp, bool append) 325 public bool AttachObject(
326 IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool addToInventory, bool append)
326 { 327 {
327 if (!Enabled) 328 if (!Enabled)
328 return false; 329 return false;
329 330
330 return AttachObjectInternal(sp, group, attachmentPt, silent, temp, true, append); 331 return AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, true, append);
331 } 332 }
332 333
333 /// <summary> 334 /// <summary>
@@ -338,10 +339,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
338 /// <param name='group'>The object to attach.</param> 339 /// <param name='group'>The object to attach.</param>
339 /// <param name='attachmentPt'></param> 340 /// <param name='attachmentPt'></param>
340 /// <param name='silent'></param> 341 /// <param name='silent'></param>
341 /// <param name='temp'></param> 342 /// <param name='addToInventory'>If true then add object to user inventory.</param>
342 /// <param name='resumeScripts'>If true then scripts are resumed on the attached object.</param> 343 /// <param name='resumeScripts'>If true then scripts are resumed on the attached object.</param>
344 /// <param name='append'>Append to attachment point rather than replace.</param>
343 private bool AttachObjectInternal( 345 private bool AttachObjectInternal(
344 IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool temp, bool resumeScripts, bool append) 346 IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool addToInventory, bool resumeScripts, bool append)
345 { 347 {
346 if (group.GetSittingAvatarsCount() != 0) 348 if (group.GetSittingAvatarsCount() != 0)
347 { 349 {
@@ -412,8 +414,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
412 414
413 lock (sp.AttachmentsSyncLock) 415 lock (sp.AttachmentsSyncLock)
414 { 416 {
415 if (sp.PresenceType != PresenceType.Npc) 417 if (addToInventory && sp.PresenceType != PresenceType.Npc)
416 UpdateUserInventoryWithAttachment(sp, group, attachmentPt, temp, append); 418 UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append);
417 419
418 AttachToAgent(sp, group, attachmentPt, attachPos, silent); 420 AttachToAgent(sp, group, attachmentPt, attachPos, silent);
419 421
@@ -432,19 +434,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
432 return true; 434 return true;
433 } 435 }
434 436
435 private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp, bool append) 437 private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool append)
436 { 438 {
437 List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt); 439 List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
438 440
439 // Add the new attachment to inventory if we don't already have it. 441 // Add the new attachment to inventory if we don't already have it.
440 if (!temp) 442 UUID newAttachmentItemID = group.FromItemID;
441 { 443 if (newAttachmentItemID == UUID.Zero)
442 UUID newAttachmentItemID = group.FromItemID; 444 newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;
443 if (newAttachmentItemID == UUID.Zero)
444 newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID;
445 445
446 ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group, append); 446 ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group, append);
447 }
448 } 447 }
449 448
450 public SceneObjectGroup RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt) 449 public SceneObjectGroup RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt)
@@ -939,7 +938,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
939 // This will throw if the attachment fails 938 // This will throw if the attachment fails
940 try 939 try
941 { 940 {
942 AttachObjectInternal(sp, objatt, attachmentPt, false, false, true, append); 941 AttachObjectInternal(sp, objatt, attachmentPt, false, true, true, append);
943 } 942 }
944 catch (Exception e) 943 catch (Exception e)
945 { 944 {
@@ -1081,7 +1080,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1081 AttachmentPt &= 0x7f; 1080 AttachmentPt &= 0x7f;
1082 1081
1083 // Calls attach with a Zero position 1082 // Calls attach with a Zero position
1084 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, false, append)) 1083 if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true, append))
1085 { 1084 {
1086 if (DebugLevel > 0) 1085 if (DebugLevel > 0)
1087 m_log.Debug( 1086 m_log.Debug(