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.

0.7.3-extended
Justin Clark-Casey (justincc) 2012-06-28 23:01:12 +01:00
parent 25109c8e4d
commit 733a8c9f89
1 changed files with 14 additions and 21 deletions

View File

@ -666,34 +666,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (itemID == UUID.Zero) // If this happened, someone made a mistake....
return;
// We can NOT use the dictionries here, as we are looking
// for an entity by the fromAssetID, which is NOT the prim UUID
EntityBase[] detachEntities = m_scene.GetEntities();
SceneObjectGroup group;
lock (sp.AttachmentsSyncLock)
{
foreach (EntityBase entity in detachEntities)
List<SceneObjectGroup> attachments = sp.GetAttachments();
foreach (SceneObjectGroup group in attachments)
{
if (entity is SceneObjectGroup)
if (group.FromItemID == itemID)
{
group = (SceneObjectGroup)entity;
if (group.FromItemID == itemID)
{
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
sp.RemoveAttachment(group);
m_scene.DeleteSceneObject(group, false);
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
sp.RemoveAttachment(group);
m_scene.DeleteSceneObject(group, false);
// Prepare sog for storage
group.AttachedAvatar = UUID.Zero;
group.RootPart.SetParentLocalId(0);
group.IsAttachment = false;
group.AbsolutePosition = group.RootPart.AttachedPos;
// Prepare sog for storage
group.AttachedAvatar = UUID.Zero;
group.RootPart.SetParentLocalId(0);
group.IsAttachment = false;
group.AbsolutePosition = group.RootPart.AttachedPos;
UpdateKnownItem(sp, group, true);
UpdateKnownItem(sp, group, true);
return;
}
return;
}
}
}