Detach attachments displaced by other attachments

prebuild-update
Melanie Thielker 2010-07-14 20:46:26 +02:00 committed by Melanie
parent e1ea82b329
commit 264f4f07cd
1 changed files with 19 additions and 5 deletions

View File

@ -140,19 +140,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);