refactor: move user inventory side of RezSingleAttachment to module

slimupdates
Justin Clark-Casey (justincc) 2010-03-05 23:29:24 +00:00
parent b88259db7d
commit b72c2dc6e8
3 changed files with 43 additions and 29 deletions

View File

@ -137,5 +137,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return true;
}
/// <summary>
/// Update the user inventory to reflect an attachment
/// </summary>
/// <param name="att"></param>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="AttachmentPt"></param>
/// <returns></returns>
public UUID SetAttachmentInventoryStatus(
SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{
m_log.DebugFormat(
"[USER INVENTORY]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
remoteClient.Name, att.Name, itemID);
if (!att.IsDeleted)
AttachmentPt = att.RootPart.AttachmentPoint;
ScenePresence presence;
if (m_scene.TryGetAvatar(remoteClient.AgentId, out presence))
{
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_scene.InventoryService.GetItem(item);
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
}
return att.UUID;
}
}
}

View File

@ -28,6 +28,7 @@
using System;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces
{
@ -45,5 +46,16 @@ namespace OpenSim.Region.Framework.Interfaces
/// <returns>true if the object was successfully attached, false otherwise</returns>
bool AttachObject(
IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent);
/// <summary>
/// Update the user inventory to the attachment of an item
/// </summary>
/// <param name="att"></param>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="AttachmentPt"></param>
/// <returns></returns>
UUID SetAttachmentInventoryStatus(
SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
}
}

View File

@ -1862,35 +1862,7 @@ namespace OpenSim.Region.Framework.Scenes
return UUID.Zero;
}
return RezSingleAttachment(att, remoteClient, itemID, AttachmentPt);
}
/// <summary>
/// Update the user inventory to reflect an attachment
/// </summary>
/// <param name="att"></param>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="AttachmentPt"></param>
/// <returns></returns>
public UUID RezSingleAttachment(SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{
m_log.DebugFormat(
"[USER INVENTORY]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
remoteClient.Name, att.Name, itemID);
if (!att.IsDeleted)
AttachmentPt = att.RootPart.AttachmentPoint;
ScenePresence presence;
if (TryGetAvatar(remoteClient.AgentId, out presence))
{
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
}
return att.UUID;
return AttachmentsModule.SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt);
}
public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,