Limit each attachment point to 5 items as per spec
parent
51de85b503
commit
9ffa08ea6b
|
@ -381,14 +381,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
|
|
||||||
private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp, bool append)
|
private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool temp, bool append)
|
||||||
{
|
{
|
||||||
// Remove any previous attachments
|
|
||||||
List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
|
List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
|
||||||
|
|
||||||
// At the moment we can only deal with a single attachment
|
// If we already have 5, remove the oldest until only 4 are left. Skip over temp ones
|
||||||
if (attachments.Count != 0 && !append)
|
while (attachments.Count >= 5)
|
||||||
{
|
{
|
||||||
if (attachments[0].FromItemID != UUID.Zero)
|
if (attachments[0].FromItemID != UUID.Zero)
|
||||||
DetachSingleAttachmentToInvInternal(sp, attachments[0]);
|
DetachSingleAttachmentToInvInternal(sp, attachments[0]);
|
||||||
|
attachments.RemoveAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're not appending, remove the rest as well
|
||||||
|
if (attachments.Count != 0 && !append)
|
||||||
|
{
|
||||||
|
foreach (SceneObjectGroup g in attachments)
|
||||||
|
{
|
||||||
|
if (g.FromItemID != UUID.Zero)
|
||||||
|
DetachSingleAttachmentToInvInternal(sp, g);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the new attachment to inventory if we don't already have it.
|
// Add the new attachment to inventory if we don't already have it.
|
||||||
|
|
Loading…
Reference in New Issue