refactor: move SOG.DetachToGround() to AttachmentsModule.DetachSceneObjectToGround() and remove redundant code
parent
ae614c1264
commit
5f3ffc195f
|
@ -472,7 +472,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (changed && m_scene.AvatarFactory != null)
|
if (changed && m_scene.AvatarFactory != null)
|
||||||
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
m_scene.AvatarFactory.QueueAppearanceSave(remoteClient.AgentId);
|
||||||
|
|
||||||
so.DetachToGround();
|
presence.RemoveAttachment(so);
|
||||||
|
DetachSceneObjectToGround(so, presence);
|
||||||
|
|
||||||
List<UUID> uuids = new List<UUID>();
|
List<UUID> uuids = new List<UUID>();
|
||||||
uuids.Add(inventoryID);
|
uuids.Add(inventoryID);
|
||||||
|
@ -483,6 +484,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
m_scene.EventManager.TriggerOnAttach(so.LocalId, sceneObjectID, UUID.Zero);
|
m_scene.EventManager.TriggerOnAttach(so.LocalId, sceneObjectID, UUID.Zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Detach the given scene objet to the ground.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// The caller has to take care of all the other work in updating avatar appearance, inventory, etc.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="so">The scene object to detach.</param>
|
||||||
|
/// <param name="sp">The scene presence from which the scene object is being detached.</param>
|
||||||
|
private void DetachSceneObjectToGround(SceneObjectGroup so, ScenePresence sp)
|
||||||
|
{
|
||||||
|
SceneObjectPart rootPart = so.RootPart;
|
||||||
|
|
||||||
|
rootPart.FromItemID = UUID.Zero;
|
||||||
|
so.AbsolutePosition = sp.AbsolutePosition;
|
||||||
|
so.ForEachPart(part => part.AttachedAvatar = UUID.Zero);
|
||||||
|
rootPart.SetParentLocalId(0);
|
||||||
|
so.ClearPartAttachmentData();
|
||||||
|
rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive, m_scene.m_physicalPrim);
|
||||||
|
so.HasGroupChanged = true;
|
||||||
|
rootPart.Rezzed = DateTime.Now;
|
||||||
|
rootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||||
|
so.AttachToBackup();
|
||||||
|
m_scene.EventManager.TriggerParcelPrimCountTainted();
|
||||||
|
rootPart.ScheduleFullUpdate();
|
||||||
|
rootPart.ClearUndoState();
|
||||||
|
}
|
||||||
|
|
||||||
// What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards.
|
// What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards.
|
||||||
// To LocalId or UUID, *THAT* is the question. How now Brown UUID??
|
// To LocalId or UUID, *THAT* is the question. How now Brown UUID??
|
||||||
private void DetachSingleAttachmentToInv(UUID itemID, ScenePresence sp)
|
private void DetachSingleAttachmentToInv(UUID itemID, ScenePresence sp)
|
||||||
|
|
|
@ -979,45 +979,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return m_rootPart.Shape.State;
|
return m_rootPart.Shape.State;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetAttachmentPoint(byte point)
|
||||||
|
{
|
||||||
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
|
for (int i = 0; i < parts.Length; i++)
|
||||||
|
parts[i].SetAttachmentPoint(point);
|
||||||
|
}
|
||||||
|
|
||||||
public void ClearPartAttachmentData()
|
public void ClearPartAttachmentData()
|
||||||
{
|
{
|
||||||
SetAttachmentPoint((Byte)0);
|
SetAttachmentPoint((Byte)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DetachToGround()
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -3349,13 +3322,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition);
|
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
|
#region ISceneObject
|
||||||
|
|
||||||
public virtual ISceneObject CloneForNewScene()
|
public virtual ISceneObject CloneForNewScene()
|
||||||
|
|
Loading…
Reference in New Issue