diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 0ea1f63..530a21c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -112,7 +112,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
112 | itemId = group.GetFromItemID(); | 112 | itemId = group.GetFromItemID(); |
113 | } | 113 | } |
114 | 114 | ||
115 | m_scene.AttachObject(remoteClient, AttachmentPt, itemId, group); | 115 | SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group); |
116 | 116 | ||
117 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); | 117 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); |
118 | 118 | ||
@@ -167,5 +167,50 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
167 | 167 | ||
168 | return att.UUID; | 168 | return att.UUID; |
169 | } | 169 | } |
170 | |||
171 | /// <summary> | ||
172 | /// Update the user inventory to reflect an attachment | ||
173 | /// </summary> | ||
174 | /// <param name="remoteClient"></param> | ||
175 | /// <param name="AttachmentPt"></param> | ||
176 | /// <param name="itemID"></param> | ||
177 | /// <param name="att"></param> | ||
178 | public void SetAttachmentInventoryStatus( | ||
179 | IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) | ||
180 | { | ||
181 | // m_log.DebugFormat( | ||
182 | // "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", | ||
183 | // att.Name, remoteClient.Name, AttachmentPt, itemID); | ||
184 | |||
185 | if (UUID.Zero == itemID) | ||
186 | { | ||
187 | m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID."); | ||
188 | return; | ||
189 | } | ||
190 | |||
191 | if (0 == AttachmentPt) | ||
192 | { | ||
193 | m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error attachment point."); | ||
194 | return; | ||
195 | } | ||
196 | |||
197 | if (null == att.RootPart) | ||
198 | { | ||
199 | m_log.Error("[SCENE INVENTORY]: Unable to save attachment for a prim without the rootpart!"); | ||
200 | return; | ||
201 | } | ||
202 | |||
203 | ScenePresence presence; | ||
204 | if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence)) | ||
205 | { | ||
206 | // XXYY!! | ||
207 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
208 | item = m_scene.InventoryService.GetItem(item); | ||
209 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | ||
210 | |||
211 | if (m_scene.AvatarFactory != null) | ||
212 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
213 | } | ||
214 | } | ||
170 | } | 215 | } |
171 | } \ No newline at end of file | 216 | } \ No newline at end of file |