aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-26 22:49:11 +0100
committerJustin Clark-Casey (justincc)2011-08-26 22:49:11 +0100
commit5f3ffc195f60ac54492ccb389843f292b0be7511 (patch)
tree37ac2512d76923f91e9f4715bee3dd8cbca7d0a1 /OpenSim/Region/CoreModules/Avatar/Attachments
parentrefactor: simplify DetachSingleAttachmentToGround() by retrieving the scene o... (diff)
downloadopensim-SC_OLD-5f3ffc195f60ac54492ccb389843f292b0be7511.zip
opensim-SC_OLD-5f3ffc195f60ac54492ccb389843f292b0be7511.tar.gz
opensim-SC_OLD-5f3ffc195f60ac54492ccb389843f292b0be7511.tar.bz2
opensim-SC_OLD-5f3ffc195f60ac54492ccb389843f292b0be7511.tar.xz
refactor: move SOG.DetachToGround() to AttachmentsModule.DetachSceneObjectToGround() and remove redundant code
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs30
1 files changed, 29 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 42a18c5..93920b0 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -472,7 +472,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
472 if (changed && m_scene.AvatarFactory != null) 472 if (changed && m_scene.AvatarFactory != null)
473 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId); 473 m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
474 474
475 so.DetachToGround(); 475 presence.RemoveAttachment(so);
476 DetachSceneObjectToGround(so, presence);
476 477
477 List<UUID> uuids = new List<UUID>(); 478 List<UUID> uuids = new List<UUID>();
478 uuids.Add(inventoryID); 479 uuids.Add(inventoryID);
@@ -482,6 +483,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
482 483
483 m_scene.EventManager.TriggerOnAttach(so.LocalId, sceneObjectID, UUID.Zero); 484 m_scene.EventManager.TriggerOnAttach(so.LocalId, sceneObjectID, UUID.Zero);
484 } 485 }
486
487 /// <summary>
488 /// Detach the given scene objet to the ground.
489 /// </summary>
490 /// <remarks>
491 /// The caller has to take care of all the other work in updating avatar appearance, inventory, etc.
492 /// </remarks>
493 /// <param name="so">The scene object to detach.</param>
494 /// <param name="sp">The scene presence from which the scene object is being detached.</param>
495 private void DetachSceneObjectToGround(SceneObjectGroup so, ScenePresence sp)
496 {
497 SceneObjectPart rootPart = so.RootPart;
498
499 rootPart.FromItemID = UUID.Zero;
500 so.AbsolutePosition = sp.AbsolutePosition;
501 so.ForEachPart(part => part.AttachedAvatar = UUID.Zero);
502 rootPart.SetParentLocalId(0);
503 so.ClearPartAttachmentData();
504 rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive, m_scene.m_physicalPrim);
505 so.HasGroupChanged = true;
506 rootPart.Rezzed = DateTime.Now;
507 rootPart.RemFlag(PrimFlags.TemporaryOnRez);
508 so.AttachToBackup();
509 m_scene.EventManager.TriggerParcelPrimCountTainted();
510 rootPart.ScheduleFullUpdate();
511 rootPart.ClearUndoState();
512 }
485 513
486 // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. 514 // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards.
487 // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? 515 // To LocalId or UUID, *THAT* is the question. How now Brown UUID??