mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
refactor: move client invoked AttachObject from SceneGraph to AttachmentsModule
This commit is contained in:
@@ -2644,12 +2644,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
|
||||
{
|
||||
client.OnRezSingleAttachmentFromInv += RezSingleAttachment;
|
||||
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
|
||||
client.OnObjectAttach += m_sceneGraph.AttachObject;
|
||||
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
|
||||
client.OnObjectDetach += m_sceneGraph.DetachObject;
|
||||
|
||||
if (AttachmentsModule != null)
|
||||
{
|
||||
client.OnObjectAttach += AttachmentsModule.AttachObject;
|
||||
client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void SubscribeToClientTeleportEvents(IClientAPI client)
|
||||
@@ -2774,7 +2776,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
client.OnRezObject -= RezObject;
|
||||
}
|
||||
|
||||
|
||||
public virtual void UnSubscribeToClientInventoryEvents(IClientAPI client)
|
||||
{
|
||||
client.OnCreateNewInventoryItem -= CreateNewInventoryItem;
|
||||
@@ -2799,12 +2800,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
|
||||
{
|
||||
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments;
|
||||
client.OnRezSingleAttachmentFromInv -= RezSingleAttachment;
|
||||
client.OnObjectAttach -= m_sceneGraph.AttachObject;
|
||||
client.OnRezSingleAttachmentFromInv -= RezSingleAttachment;
|
||||
client.OnObjectDetach -= m_sceneGraph.DetachObject;
|
||||
|
||||
if (AttachmentsModule != null)
|
||||
{
|
||||
client.OnObjectAttach -= AttachmentsModule.AttachObject;
|
||||
client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client)
|
||||
|
||||
@@ -486,41 +486,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event Handling routine for Attach Object
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="objectLocalID"></param>
|
||||
/// <param name="AttachmentPt"></param>
|
||||
/// <param name="rot"></param>
|
||||
protected internal void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent)
|
||||
{
|
||||
// If we can't take it, we can't attach it!
|
||||
SceneObjectPart part = m_parentScene.GetSceneObjectPart(objectLocalID);
|
||||
if (part == null)
|
||||
return;
|
||||
|
||||
if (!m_parentScene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
if (m_parentScene.AttachmentsModule.AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
|
||||
{
|
||||
m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||
|
||||
// Save avatar attachment information
|
||||
ScenePresence presence;
|
||||
if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence))
|
||||
{
|
||||
m_log.Info(
|
||||
"[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||
+ ", AttachmentPoint: " + AttachmentPt);
|
||||
|
||||
m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rez an attachment
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user