diff options
Diffstat (limited to 'OpenSim')
-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 527934d..ff3036a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -140,19 +140,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
140 | group.SetAttachmentPoint((byte)AttachmentPt); | 140 | group.SetAttachmentPoint((byte)AttachmentPt); |
141 | group.AbsolutePosition = attachPos; | 141 | group.AbsolutePosition = attachPos; |
142 | 142 | ||
143 | // Saves and gets itemID | 143 | // Remove any previous attachments |
144 | UUID itemId; | 144 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); |
145 | UUID itemID = UUID.Zero; | ||
146 | if (sp != null) | ||
147 | { | ||
148 | foreach(SceneObjectGroup grp in sp.Attachments) | ||
149 | { | ||
150 | if (grp.GetAttachmentPoint() == (byte)AttachmentPt) | ||
151 | { | ||
152 | itemID = grp.GetFromItemID(); | ||
153 | break; | ||
154 | } | ||
155 | } | ||
156 | if (itemID != UUID.Zero) | ||
157 | DetachSingleAttachmentToInv(itemID, remoteClient); | ||
158 | } | ||
145 | 159 | ||
146 | if (group.GetFromItemID() == UUID.Zero) | 160 | if (group.GetFromItemID() == UUID.Zero) |
147 | { | 161 | { |
148 | m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); | 162 | m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID); |
149 | } | 163 | } |
150 | else | 164 | else |
151 | { | 165 | { |
152 | itemId = group.GetFromItemID(); | 166 | itemID = group.GetFromItemID(); |
153 | } | 167 | } |
154 | 168 | ||
155 | SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group); | 169 | SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group); |
156 | 170 | ||
157 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); | 171 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); |
158 | 172 | ||