Detach attachments displaced by other attachments

avinationmerge
Melanie Thielker 2010-07-14 20:46:26 +02:00 committed by Melanie
parent 0b74662ce2
commit 50d56c54a3
1 changed files with 19 additions and 5 deletions

View File

@ -142,19 +142,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
group.SetAttachmentPoint((byte)AttachmentPt);
group.AbsolutePosition = attachPos;
// Saves and gets itemID
UUID itemId;
// Remove any previous attachments
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
UUID itemID = UUID.Zero;
if (sp != null)
{
foreach(SceneObjectGroup grp in sp.Attachments)
{
if (grp.GetAttachmentPoint() == (byte)AttachmentPt)
{
itemID = grp.GetFromItemID();
break;
}
}
if (itemID != UUID.Zero)
DetachSingleAttachmentToInv(itemID, remoteClient);
}
if (group.GetFromItemID() == UUID.Zero)
{
m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId);
m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID);
}
else
{
itemId = group.GetFromItemID();
itemID = group.GetFromItemID();
}
SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group);
SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group);
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);