refactor: extract method UpdateUserInventoryWithAttachment() from AttachObject() for better code comprehension
parent
843112340e
commit
f6e5791ecd
|
@ -293,8 +293,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
group.AttachmentPoint = attachmentPt;
|
||||
group.AbsolutePosition = attachPos;
|
||||
|
||||
// We also don't want to do any of the inventory operations for an NPC.
|
||||
if (sp.PresenceType != PresenceType.Npc)
|
||||
UpdateUserInventoryWithAttachment(sp, group, attachmentPt);
|
||||
|
||||
AttachToAgent(sp, group, attachmentPt, attachPos, silent);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void UpdateUserInventoryWithAttachment(IScenePresence sp, SceneObjectGroup group, uint attachmentPt)
|
||||
{
|
||||
// Remove any previous attachments
|
||||
List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt);
|
||||
|
@ -318,12 +326,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group);
|
||||
}
|
||||
|
||||
AttachToAgent(sp, group, attachmentPt, attachPos, silent);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt)
|
||||
{
|
||||
if (!Enabled)
|
||||
|
@ -652,7 +654,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
// "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}",
|
||||
// grp.Name, grp.LocalId, remoteClient.Name);
|
||||
|
||||
InventoryItemBase newItem = m_invAccessModule.CopyToInventory(
|
||||
InventoryItemBase newItem
|
||||
= m_invAccessModule.CopyToInventory(
|
||||
DeRezAction.TakeCopy,
|
||||
m_scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object).ID,
|
||||
new List<SceneObjectGroup> { grp },
|
||||
|
@ -782,8 +785,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
item = m_scene.InventoryService.GetItem(item);
|
||||
bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID);
|
||||
if (changed && m_scene.AvatarFactory != null)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Queueing appearance save for {0}, attachment {1} point {2} in ShowAttachInUserInventory()",
|
||||
// sp.Name, att.Name, AttachmentPt);
|
||||
|
||||
m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
Loading…
Reference in New Issue