aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-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 }