refactor: move SOG.AttachToAgent() into AttachmentsModule

This commit is contained in:
Justin Clark-Casey (justincc)
2010-09-01 01:11:52 +01:00
parent c947a67b23
commit 6cbf66827b
2 changed files with 74 additions and 78 deletions

View File

@@ -977,77 +977,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// Attach this scene object to the given avatar.
/// </summary>
/// <param name="agentID"></param>
/// <param name="attachmentpoint"></param>
/// <param name="AttachOffset"></param>
public void AttachToAgent(UUID agentID, uint attachmentpoint, Vector3 AttachOffset, bool silent)
{
ScenePresence avatar = m_scene.GetScenePresence(agentID);
if (avatar != null)
{
// don't attach attachments to child agents
if (avatar.IsChildAgent) return;
// m_log.DebugFormat("[SOG]: Adding attachment {0} to avatar {1}", Name, avatar.Name);
DetachFromBackup();
// Remove from database and parcel prim count
m_scene.DeleteFromStorage(UUID);
m_scene.EventManager.TriggerParcelPrimCountTainted();
m_rootPart.AttachedAvatar = agentID;
//Anakin Lohner bug #3839
lock (m_parts)
{
foreach (SceneObjectPart p in m_parts.Values)
{
p.AttachedAvatar = agentID;
}
}
if (m_rootPart.PhysActor != null)
{
m_scene.PhysicsScene.RemovePrim(m_rootPart.PhysActor);
m_rootPart.PhysActor = null;
}
AbsolutePosition = AttachOffset;
m_rootPart.AttachedPos = AttachOffset;
m_rootPart.IsAttachment = true;
m_rootPart.SetParentLocalId(avatar.LocalId);
SetAttachmentPoint(Convert.ToByte(attachmentpoint));
avatar.AddAttachment(this);
if (!silent)
{
// Killing it here will cause the client to deselect it
// It then reappears on the avatar, deselected
// through the full update below
//
if (IsSelected)
{
m_scene.SendKillObject(m_rootPart.LocalId);
}
IsSelected = false; // fudge....
ScheduleGroupForFullUpdate();
}
}
else
{
m_log.WarnFormat(
"[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present",
UUID, agentID, Scene.RegionInfo.RegionName);
}
}
public byte GetAttachmentPoint()
{
return m_rootPart.Shape.State;