Fix issue where loading a new appearance onto an NPC would not remove the previous attachments from the scene.

Addresses http://opensimulator.org/mantis/view.php?id=5636
This commit is contained in:
Justin Clark-Casey (justincc)
2011-08-17 01:35:33 +01:00
parent bd5d35ee32
commit acfdca34fd
3 changed files with 14 additions and 3 deletions

View File

@@ -143,6 +143,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC
if (!m_avatars.ContainsKey(agentId))
return false;
// FIXME: An extremely bad bit of code that reaches directly into the attachments list and manipulates it
List<SceneObjectGroup> attachments = sp.Attachments;
lock (attachments)
{
foreach (SceneObjectGroup att in attachments)
scene.DeleteSceneObject(att, false);
attachments.Clear();
}
AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
sp.Appearance = npcAppearance;
sp.RezAttachments();