From 71797af540bfa1ccb1ccfe856b42350844531607 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 5 Mar 2010 23:35:49 +0000
Subject: refactor: move another AttachObject method
---
.../Avatar/Attachments/AttachmentsModule.cs | 47 +++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/CoreModules/Avatar/Attachments')
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
itemId = group.GetFromItemID();
}
- m_scene.AttachObject(remoteClient, AttachmentPt, itemId, group);
+ SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group);
group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
@@ -167,5 +167,50 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return att.UUID;
}
+
+ ///
+ /// Update the user inventory to reflect an attachment
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void SetAttachmentInventoryStatus(
+ IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
+ {
+// m_log.DebugFormat(
+// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}",
+// att.Name, remoteClient.Name, AttachmentPt, itemID);
+
+ if (UUID.Zero == itemID)
+ {
+ m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID.");
+ return;
+ }
+
+ if (0 == AttachmentPt)
+ {
+ m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error attachment point.");
+ return;
+ }
+
+ if (null == att.RootPart)
+ {
+ m_log.Error("[SCENE INVENTORY]: Unable to save attachment for a prim without the rootpart!");
+ return;
+ }
+
+ ScenePresence presence;
+ if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence))
+ {
+ // XXYY!!
+ InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
+ item = m_scene.InventoryService.GetItem(item);
+ presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
+
+ if (m_scene.AvatarFactory != null)
+ m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
+ }
+ }
}
}
\ No newline at end of file
--
cgit v1.1