aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-26 22:37:53 +0100
committerJustin Clark-Casey (justincc)2011-08-26 22:37:53 +0100
commitae614c1264a2c4d06f019f2a91ad481cc2f96770 (patch)
tree2c60b6c35282e88628f3b0d04a449c01af53f06a /OpenSim/Region/CoreModules
parentrefactor: remove common presence set up in attachments tests (diff)
downloadopensim-SC-ae614c1264a2c4d06f019f2a91ad481cc2f96770.zip
opensim-SC-ae614c1264a2c4d06f019f2a91ad481cc2f96770.tar.gz
opensim-SC-ae614c1264a2c4d06f019f2a91ad481cc2f96770.tar.bz2
opensim-SC-ae614c1264a2c4d06f019f2a91ad481cc2f96770.tar.xz
refactor: simplify DetachSingleAttachmentToGround() by retrieving the scene object group direct
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs19
1 files changed, 10 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 732e3e3..42a18c5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -449,29 +449,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
449 } 449 }
450 } 450 }
451 451
452 public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) 452 public void DetachSingleAttachmentToGround(UUID sceneObjectID, IClientAPI remoteClient)
453 { 453 {
454 SceneObjectPart part = m_scene.GetSceneObjectPart(itemID); 454 SceneObjectGroup so = m_scene.GetSceneObjectGroup(sceneObjectID);
455 if (part == null || part.ParentGroup == null) 455
456 if (so == null)
456 return; 457 return;
457 458
458 if (part.ParentGroup.RootPart.AttachedAvatar != remoteClient.AgentId) 459 if (so.RootPart.AttachedAvatar != remoteClient.AgentId)
459 return; 460 return;
460 461
461 UUID inventoryID = part.ParentGroup.GetFromItemID(); 462 UUID inventoryID = so.GetFromItemID();
462 463
463 ScenePresence presence; 464 ScenePresence presence;
464 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 465 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
465 { 466 {
466 if (!m_scene.Permissions.CanRezObject( 467 if (!m_scene.Permissions.CanRezObject(
467 part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition)) 468 so.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
468 return; 469 return;
469 470
470 bool changed = presence.Appearance.DetachAttachment(itemID); 471 bool changed = presence.Appearance.DetachAttachment(sceneObjectID);
471 if (changed && m_scene.AvatarFactory != null) 472 if (changed && m_scene.AvatarFactory != null)
472 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); 473 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
473 474
474 part.ParentGroup.DetachToGround(); 475 so.DetachToGround();
475 476
476 List<UUID> uuids = new List<UUID>(); 477 List<UUID> uuids = new List<UUID>();
477 uuids.Add(inventoryID); 478 uuids.Add(inventoryID);
@@ -479,7 +480,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
479 remoteClient.SendRemoveInventoryItem(inventoryID); 480 remoteClient.SendRemoveInventoryItem(inventoryID);
480 } 481 }
481 482
482 m_scene.EventManager.TriggerOnAttach(part.ParentGroup.LocalId, itemID, UUID.Zero); 483 m_scene.EventManager.TriggerOnAttach(so.LocalId, sceneObjectID, UUID.Zero);
483 } 484 }
484 485
485 // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. 486 // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards.