From 5f3ffc195f60ac54492ccb389843f292b0be7511 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 26 Aug 2011 22:49:11 +0100 Subject: refactor: move SOG.DetachToGround() to AttachmentsModule.DetachSceneObjectToGround() and remove redundant code --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 46 +++------------------- 1 file changed, 6 insertions(+), 40 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 00e3363..e3b8fc8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -979,43 +979,16 @@ namespace OpenSim.Region.Framework.Scenes return m_rootPart.Shape.State; } - public void ClearPartAttachmentData() - { - SetAttachmentPoint((Byte)0); - } - - public void DetachToGround() + public void SetAttachmentPoint(byte point) { - ScenePresence avatar = m_scene.GetScenePresence(m_rootPart.AttachedAvatar); - if (avatar == null) - return; - - avatar.RemoveAttachment(this); - - Vector3 detachedpos = new Vector3(127f,127f,127f); - if (avatar == null) - return; - - detachedpos = avatar.AbsolutePosition; - RootPart.FromItemID = UUID.Zero; - - AbsolutePosition = detachedpos; - m_rootPart.AttachedAvatar = UUID.Zero; - SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) - parts[i].AttachedAvatar = UUID.Zero; + parts[i].SetAttachmentPoint(point); + } - m_rootPart.SetParentLocalId(0); - SetAttachmentPoint((byte)0); - m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_scene.m_physicalPrim); - HasGroupChanged = true; - RootPart.Rezzed = DateTime.Now; - RootPart.RemFlag(PrimFlags.TemporaryOnRez); - AttachToBackup(); - m_scene.EventManager.TriggerParcelPrimCountTainted(); - m_rootPart.ScheduleFullUpdate(); - m_rootPart.ClearUndoState(); + public void ClearPartAttachmentData() + { + SetAttachmentPoint((Byte)0); } /// @@ -3349,13 +3322,6 @@ namespace OpenSim.Region.Framework.Scenes return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); } - public void SetAttachmentPoint(byte point) - { - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].SetAttachmentPoint(point); - } - #region ISceneObject public virtual ISceneObject CloneForNewScene() -- cgit v1.1