diff options
author | Justin Clark-Casey (justincc) | 2011-08-17 01:35:33 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-17 01:35:33 +0100 |
commit | acfdca34fd9bf6d66d144ae5c0a325dd5e864517 (patch) | |
tree | fa04bcde5a48a26ef3867d82019f8f1eb35cb6b8 | |
parent | extend test to check that there is one attachment and that it has the right name (diff) | |
download | opensim-SC_OLD-acfdca34fd9bf6d66d144ae5c0a325dd5e864517.zip opensim-SC_OLD-acfdca34fd9bf6d66d144ae5c0a325dd5e864517.tar.gz opensim-SC_OLD-acfdca34fd9bf6d66d144ae5c0a325dd5e864517.tar.bz2 opensim-SC_OLD-acfdca34fd9bf6d66d144ae5c0a325dd5e864517.tar.xz |
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
3 files changed, 14 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 4dbc5e6..0316d29 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -101,7 +101,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
101 | /// <param name="silent"></param> | 101 | /// <param name="silent"></param> |
102 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) | 102 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) |
103 | { | 103 | { |
104 | m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); | 104 | // m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); |
105 | 105 | ||
106 | try | 106 | try |
107 | { | 107 | { |
@@ -466,7 +466,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
466 | { | 466 | { |
467 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 467 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
468 | group.DetachToInventoryPrep(); | 468 | group.DetachToInventoryPrep(); |
469 | m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); | 469 | // m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); |
470 | 470 | ||
471 | // If an item contains scripts, it's always changed. | 471 | // If an item contains scripts, it's always changed. |
472 | // This ensures script state is saved on detach | 472 | // This ensures script state is saved on detach |
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 6cc64c6..4cb3df2 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -96,9 +96,10 @@ namespace OpenSim.Region.Framework.Interfaces | |||
96 | /// <summary> | 96 | /// <summary> |
97 | /// Detach an object from the avatar. | 97 | /// Detach an object from the avatar. |
98 | /// </summary> | 98 | /// </summary> |
99 | /// | 99 | /// <remarks> |
100 | /// This method is called in response to a client's detach request, so we only update the information in | 100 | /// This method is called in response to a client's detach request, so we only update the information in |
101 | /// inventory | 101 | /// inventory |
102 | /// </remarks> | ||
102 | /// <param name="objectLocalID"></param> | 103 | /// <param name="objectLocalID"></param> |
103 | /// <param name="remoteClient"></param> | 104 | /// <param name="remoteClient"></param> |
104 | void DetachObject(uint objectLocalID, IClientAPI remoteClient); | 105 | void DetachObject(uint objectLocalID, IClientAPI remoteClient); |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 11fda6d..3b7ae9d 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -143,6 +143,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
143 | if (!m_avatars.ContainsKey(agentId)) | 143 | if (!m_avatars.ContainsKey(agentId)) |
144 | return false; | 144 | return false; |
145 | 145 | ||
146 | // FIXME: An extremely bad bit of code that reaches directly into the attachments list and manipulates it | ||
147 | List<SceneObjectGroup> attachments = sp.Attachments; | ||
148 | lock (attachments) | ||
149 | { | ||
150 | foreach (SceneObjectGroup att in attachments) | ||
151 | scene.DeleteSceneObject(att, false); | ||
152 | |||
153 | attachments.Clear(); | ||
154 | } | ||
155 | |||
146 | AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); | 156 | AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); |
147 | sp.Appearance = npcAppearance; | 157 | sp.Appearance = npcAppearance; |
148 | sp.RezAttachments(); | 158 | sp.RezAttachments(); |