From 26e38842372e934937be36a21d8a99742cd485fe Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 17 Apr 2010 00:00:45 +0100
Subject: refactor: move DeatchObject() into the AttachmentsModule
---
.../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 10 ++++++++++
OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | 10 ++++++++++
OpenSim/Region/Framework/Scenes/Scene.cs | 10 ++++------
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index f8fb7ca..c87a383 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -323,6 +323,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
}
+ public void DetachObject(uint objectLocalID, IClientAPI remoteClient)
+ {
+ SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
+ if (group != null)
+ {
+ //group.DetachToGround();
+ ShowDetachInUserInventory(group.GetFromItemID(), remoteClient);
+ }
+ }
+
public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient)
{
ScenePresence presence;
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index d43ce1f..f8af367 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -94,6 +94,16 @@ namespace OpenSim.Region.Framework.Interfaces
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects);
///
+ /// Detach an object from the avatar.
+ ///
+ ///
+ /// This method is called in response to a client's detach request, so we only update the information in
+ /// inventory
+ ///
+ ///
+ void DetachObject(uint objectLocalID, IClientAPI remoteClient);
+
+ ///
/// Detach the given item to the ground.
///
///
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d4da2cb..a34f57e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2769,14 +2769,13 @@ namespace OpenSim.Region.Framework.Scenes
}
public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
- {
- client.OnObjectDetach += m_sceneGraph.DetachObject;
-
+ {
if (AttachmentsModule != null)
{
client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory;
client.OnRezMultipleAttachmentsFromInv += AttachmentsModule.RezMultipleAttachmentsFromInventory;
client.OnObjectAttach += AttachmentsModule.AttachObject;
+ client.OnObjectDetach += AttachmentsModule.DetachObject;
client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
}
}
@@ -2925,14 +2924,13 @@ namespace OpenSim.Region.Framework.Scenes
}
public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
- {
- client.OnObjectDetach -= m_sceneGraph.DetachObject;
-
+ {
if (AttachmentsModule != null)
{
client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory;
client.OnRezMultipleAttachmentsFromInv -= AttachmentsModule.RezMultipleAttachmentsFromInventory;
client.OnObjectAttach -= AttachmentsModule.AttachObject;
+ client.OnObjectDetach -= AttachmentsModule.DetachObject;
client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
}
}
--
cgit v1.1