diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 902fb88..34198d2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -142,19 +142,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
142 | group.SetAttachmentPoint((byte)AttachmentPt); | 142 | group.SetAttachmentPoint((byte)AttachmentPt); |
143 | group.AbsolutePosition = attachPos; | 143 | group.AbsolutePosition = attachPos; |
144 | 144 | ||
145 | // Saves and gets itemID | 145 | // Remove any previous attachments |
146 | UUID itemId; | 146 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); |
147 | UUID itemID = UUID.Zero; | ||
148 | if (sp != null) | ||
149 | { | ||
150 | foreach(SceneObjectGroup grp in sp.Attachments) | ||
151 | { | ||
152 | if (grp.GetAttachmentPoint() == (byte)AttachmentPt) | ||
153 | { | ||
154 | itemID = grp.GetFromItemID(); | ||
155 | break; | ||
156 | } | ||
157 | } | ||
158 | if (itemID != UUID.Zero) | ||
159 | DetachSingleAttachmentToInv(itemID, remoteClient); | ||
160 | } | ||
147 | 161 | ||
148 | if (group.GetFromItemID() == UUID.Zero) | 162 | if (group.GetFromItemID() == UUID.Zero) |
149 | { | 163 | { |
150 | m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); | 164 | m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID); |
151 | } | 165 | } |
152 | else | 166 | else |
153 | { | 167 | { |
154 | itemId = group.GetFromItemID(); | 168 | itemID = group.GetFromItemID(); |
155 | } | 169 | } |
156 | 170 | ||
157 | SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group); | 171 | SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group); |
158 | 172 | ||
159 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); | 173 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); |
160 | 174 | ||