refactor: crudely move the RezMultipleAttachments() method into the AttachmentsModule

slimupdates
Justin Clark-Casey (justincc) 2010-04-16 22:54:25 +01:00
parent e9926d13cf
commit 17d023ba5b
4 changed files with 28 additions and 14 deletions

View File

@ -30,6 +30,7 @@ using System.Reflection;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework; using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
@ -169,6 +170,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return true; return true;
} }
public void RezMultipleAttachmentsFromInventory(
IClientAPI remoteClient,
RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
{
foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
{
RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt);
}
}
public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{ {
m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name); m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);

View File

@ -27,6 +27,7 @@
using System; using System;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
@ -81,6 +82,17 @@ namespace OpenSim.Region.Framework.Interfaces
UUID RezSingleAttachmentFromInventory( UUID RezSingleAttachmentFromInventory(
IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus); IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus);
/// <summary>
/// Rez multiple attachments from a user's inventory
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="header"></param>
/// <param name="objects"></param>
void RezMultipleAttachmentsFromInventory(
IClientAPI remoteClient,
RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects);
/// <summary> /// <summary>
/// Update the user inventory to the attachment of an item /// Update the user inventory to the attachment of an item
/// </summary> /// </summary>

View File

@ -35,7 +35,6 @@ using OpenMetaverse;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework; using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Region.Framework.Scenes.Serialization;
@ -1875,15 +1874,6 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerOnAttach(localID, itemID, avatarID); EventManager.TriggerOnAttach(localID, itemID, avatarID);
} }
public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
{
foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
{
AttachmentsModule.RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt);
}
}
public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient)
{ {
SceneObjectPart part = GetSceneObjectPart(itemID); SceneObjectPart part = GetSceneObjectPart(itemID);

View File

@ -2770,12 +2770,12 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
{ {
client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
client.OnObjectDetach += m_sceneGraph.DetachObject; client.OnObjectDetach += m_sceneGraph.DetachObject;
if (AttachmentsModule != null) if (AttachmentsModule != null)
{ {
client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory; client.OnRezSingleAttachmentFromInv += AttachmentsModule.RezSingleAttachmentFromInventory;
client.OnRezMultipleAttachmentsFromInv += AttachmentsModule.RezMultipleAttachmentsFromInventory;
client.OnObjectAttach += AttachmentsModule.AttachObject; client.OnObjectAttach += AttachmentsModule.AttachObject;
client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory; client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
} }
@ -2926,12 +2926,12 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
{ {
client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments;
client.OnObjectDetach -= m_sceneGraph.DetachObject; client.OnObjectDetach -= m_sceneGraph.DetachObject;
if (AttachmentsModule != null) if (AttachmentsModule != null)
{ {
client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory; client.OnRezSingleAttachmentFromInv -= AttachmentsModule.RezSingleAttachmentFromInventory;
client.OnRezMultipleAttachmentsFromInv -= AttachmentsModule.RezMultipleAttachmentsFromInventory;
client.OnObjectAttach -= AttachmentsModule.AttachObject; client.OnObjectAttach -= AttachmentsModule.AttachObject;
client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory; client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
} }