aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-03-05 23:35:49 +0000
committerJustin Clark-Casey (justincc)2010-03-05 23:35:49 +0000
commit71797af540bfa1ccb1ccfe856b42350844531607 (patch)
treea8ee5316ac6bb371edc2570558da8cc149352920 /OpenSim/Region
parentrefactor: move user inventory side of RezSingleAttachment to module (diff)
downloadopensim-SC-71797af540bfa1ccb1ccfe856b42350844531607.zip
opensim-SC-71797af540bfa1ccb1ccfe856b42350844531607.tar.gz
opensim-SC-71797af540bfa1ccb1ccfe856b42350844531607.tar.bz2
opensim-SC-71797af540bfa1ccb1ccfe856b42350844531607.tar.xz
refactor: move another AttachObject method
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs44
2 files changed, 46 insertions, 45 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
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 6a5dc56..bd3b433 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1874,50 +1874,6 @@ namespace OpenSim.Region.Framework.Scenes
1874 } 1874 }
1875 } 1875 }
1876 1876
1877 /// <summary>
1878 /// This registers the item as attached in a user's inventory
1879 /// </summary>
1880 /// <param name="remoteClient"></param>
1881 /// <param name="AttachmentPt"></param>
1882 /// <param name="itemID"></param>
1883 /// <param name="att"></param>
1884 public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
1885 {
1886// m_log.DebugFormat(
1887// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}",
1888// att.Name, remoteClient.Name, AttachmentPt, itemID);
1889
1890 if (UUID.Zero == itemID)
1891 {
1892 m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID.");
1893 return;
1894 }
1895
1896 if (0 == AttachmentPt)
1897 {
1898 m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error attachment point.");
1899 return;
1900 }
1901
1902 if (null == att.RootPart)
1903 {
1904 m_log.Error("[SCENE INVENTORY]: Unable to save attachment for a prim without the rootpart!");
1905 return;
1906 }
1907
1908 ScenePresence presence;
1909 if (TryGetAvatar(remoteClient.AgentId, out presence))
1910 {
1911 // XXYY!!
1912 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1913 item = InventoryService.GetItem(item);
1914 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
1915
1916 if (m_AvatarFactory != null)
1917 m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
1918 }
1919 }
1920
1921 public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) 1877 public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient)
1922 { 1878 {
1923 SceneObjectPart part = GetSceneObjectPart(itemID); 1879 SceneObjectPart part = GetSceneObjectPart(itemID);