diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 7 |
2 files changed, 12 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index b7a7f77..02fd387 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private Scene m_scene = null; | 49 | private Scene m_scene; |
50 | private IDialogModule m_dialogModule; | 50 | private IDialogModule m_dialogModule; |
51 | 51 | ||
52 | public string Name { get { return "Attachments Module"; } } | 52 | public string Name { get { return "Attachments Module"; } } |
@@ -83,6 +83,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
83 | client.OnObjectAttach += AttachObject; | 83 | client.OnObjectAttach += AttachObject; |
84 | client.OnObjectDetach += DetachObject; | 84 | client.OnObjectDetach += DetachObject; |
85 | client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv; | 85 | client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv; |
86 | client.OnObjectDrop += DetachSingleAttachmentToGround; | ||
86 | } | 87 | } |
87 | 88 | ||
88 | public void UnsubscribeFromClientEvents(IClientAPI client) | 89 | public void UnsubscribeFromClientEvents(IClientAPI client) |
@@ -92,6 +93,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
92 | client.OnObjectAttach -= AttachObject; | 93 | client.OnObjectAttach -= AttachObject; |
93 | client.OnObjectDetach -= DetachObject; | 94 | client.OnObjectDetach -= DetachObject; |
94 | client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv; | 95 | client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv; |
96 | client.OnObjectDrop -= DetachSingleAttachmentToGround; | ||
95 | } | 97 | } |
96 | 98 | ||
97 | /// <summary> | 99 | /// <summary> |
@@ -250,12 +252,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
250 | } | 252 | } |
251 | } | 253 | } |
252 | 254 | ||
253 | public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 255 | public ISceneEntity RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) |
254 | { | 256 | { |
255 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true); | 257 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true); |
256 | } | 258 | } |
257 | 259 | ||
258 | public UUID RezSingleAttachmentFromInventory( | 260 | public ISceneEntity RezSingleAttachmentFromInventory( |
259 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | 261 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) |
260 | { | 262 | { |
261 | // m_log.DebugFormat( | 263 | // m_log.DebugFormat( |
@@ -269,7 +271,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
269 | m_log.ErrorFormat( | 271 | m_log.ErrorFormat( |
270 | "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()", | 272 | "[ATTACHMENTS MODULE]: Could not find presence for client {0} {1} in RezSingleAttachmentFromInventory()", |
271 | remoteClient.Name, remoteClient.AgentId); | 273 | remoteClient.Name, remoteClient.AgentId); |
272 | return UUID.Zero; | 274 | return null; |
273 | } | 275 | } |
274 | 276 | ||
275 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should | 277 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should |
@@ -286,10 +288,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
286 | ShowAttachInUserInventory(att, sp, itemID, AttachmentPt); | 288 | ShowAttachInUserInventory(att, sp, itemID, AttachmentPt); |
287 | } | 289 | } |
288 | 290 | ||
289 | if (null == att) | 291 | return att; |
290 | return UUID.Zero; | ||
291 | else | ||
292 | return att.UUID; | ||
293 | } | 292 | } |
294 | 293 | ||
295 | private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 294 | private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
@@ -449,13 +448,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
449 | } | 448 | } |
450 | } | 449 | } |
451 | 450 | ||
452 | public void DetachSingleAttachmentToGround(UUID sceneObjectID, IClientAPI remoteClient) | 451 | public void DetachSingleAttachmentToGround(uint soLocalId, IClientAPI remoteClient) |
453 | { | 452 | { |
454 | // m_log.DebugFormat( | 453 | // m_log.DebugFormat( |
455 | // "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", | 454 | // "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}", |
456 | // remoteClient.Name, sceneObjectID); | 455 | // remoteClient.Name, sceneObjectID); |
457 | 456 | ||
458 | SceneObjectGroup so = m_scene.GetSceneObjectGroup(sceneObjectID); | 457 | SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId); |
459 | 458 | ||
460 | if (so == null) | 459 | if (so == null) |
461 | return; | 460 | return; |
@@ -489,7 +488,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
489 | remoteClient.SendRemoveInventoryItem(inventoryID); | 488 | remoteClient.SendRemoveInventoryItem(inventoryID); |
490 | } | 489 | } |
491 | 490 | ||
492 | m_scene.EventManager.TriggerOnAttach(so.LocalId, sceneObjectID, UUID.Zero); | 491 | m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); |
493 | } | 492 | } |
494 | 493 | ||
495 | /// <summary> | 494 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index b1f9197..b0146a1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -168,12 +168,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
168 | UserInventoryHelpers.CreateInventoryItem( | 168 | UserInventoryHelpers.CreateInventoryItem( |
169 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); | 169 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); |
170 | 170 | ||
171 | // Check item status | 171 | ISceneEntity so = m_attMod.RezSingleAttachmentFromInventory( |
172 | Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItemId)), Is.Not.Null); | ||
173 | |||
174 | UUID attSoId = m_attMod.RezSingleAttachmentFromInventory( | ||
175 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); | 172 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); |
176 | m_attMod.DetachSingleAttachmentToGround(attSoId, m_presence.ControllingClient); | 173 | m_attMod.DetachSingleAttachmentToGround(so.LocalId, m_presence.ControllingClient); |
177 | 174 | ||
178 | // Check scene presence status | 175 | // Check scene presence status |
179 | Assert.That(m_presence.HasAttachments(), Is.False); | 176 | Assert.That(m_presence.HasAttachments(), Is.False); |