aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-06-28 23:01:12 +0100
committerJustin Clark-Casey (justincc)2012-06-28 23:01:12 +0100
commit571fd966cbcb4e718703bc194384f6bf84c211df (patch)
tree8cd719979ce39596cc6bec46a1eff276c95121b1 /OpenSim
parentRemove code that tried to delete an attachment back to inventory if RezSingle... (diff)
downloadopensim-SC_OLD-571fd966cbcb4e718703bc194384f6bf84c211df.zip
opensim-SC_OLD-571fd966cbcb4e718703bc194384f6bf84c211df.tar.gz
opensim-SC_OLD-571fd966cbcb4e718703bc194384f6bf84c211df.tar.bz2
opensim-SC_OLD-571fd966cbcb4e718703bc194384f6bf84c211df.tar.xz
Rather than iterating through all SOGs in the scene looking for the one that matches out fromItemID on detach, go through the agent's attachment sog list instead.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs41
1 files changed, 17 insertions, 24 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index e3ee2fc..e9f0488 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -666,34 +666,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
666 if (itemID == UUID.Zero) // If this happened, someone made a mistake.... 666 if (itemID == UUID.Zero) // If this happened, someone made a mistake....
667 return; 667 return;
668 668
669 // We can NOT use the dictionries here, as we are looking
670 // for an entity by the fromAssetID, which is NOT the prim UUID
671 EntityBase[] detachEntities = m_scene.GetEntities();
672 SceneObjectGroup group;
673
674 lock (sp.AttachmentsSyncLock) 669 lock (sp.AttachmentsSyncLock)
675 { 670 {
676 foreach (EntityBase entity in detachEntities) 671 List<SceneObjectGroup> attachments = sp.GetAttachments();
672
673 foreach (SceneObjectGroup group in attachments)
677 { 674 {
678 if (entity is SceneObjectGroup) 675 if (group.FromItemID == itemID)
679 { 676 {
680 group = (SceneObjectGroup)entity; 677 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
681 if (group.FromItemID == itemID) 678 sp.RemoveAttachment(group);
682 { 679 m_scene.DeleteSceneObject(group, false);
683 m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); 680
684 sp.RemoveAttachment(group); 681 // Prepare sog for storage
685 m_scene.DeleteSceneObject(group, false); 682 group.AttachedAvatar = UUID.Zero;
686 683 group.RootPart.SetParentLocalId(0);
687 // Prepare sog for storage 684 group.IsAttachment = false;
688 group.AttachedAvatar = UUID.Zero; 685 group.AbsolutePosition = group.RootPart.AttachedPos;
689 group.RootPart.SetParentLocalId(0); 686
690 group.IsAttachment = false; 687 UpdateKnownItem(sp, group, true);
691 group.AbsolutePosition = group.RootPart.AttachedPos; 688
692 689 return;
693 UpdateKnownItem(sp, group, true);
694
695 return;
696 }
697 } 690 }
698 } 691 }
699 } 692 }