Stop NPCs losing attachments when the source avatar takes them off.

This was happening because we were using the source avatar's item IDs in the clone appearance.
Switch to using the asset IDs of attachments instead for NPCs.
The InventoryAccessModule and AttachmentModule had to be changed to allow rezzing of an object without an associated inventory item.
Hopefully goes some way towards resolving http://opensimulator.org/mantis/view.php?id=5653
This commit is contained in:
Justin Clark-Casey (justincc)
2011-09-03 01:11:16 +01:00
parent e6eb0d9a6f
commit 5c1fa968ab
7 changed files with 154 additions and 70 deletions

View File

@@ -433,6 +433,10 @@ namespace OpenSim.Framework
if (attachpoint == 0)
return false;
// m_log.DebugFormat(
// "[AVATAR APPEARANCE]: Setting attachment at {0} with item ID {1}, asset ID {2}",
// attachpoint, item, asset);
if (item == UUID.Zero)
{
if (m_attachments.ContainsKey(attachpoint))
@@ -459,7 +463,7 @@ namespace OpenSim.Framework
}
else
{
ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset));
ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset));
}
return true;
}
@@ -608,7 +612,14 @@ namespace OpenSim.Framework
{
OSDArray attachs = (OSDArray)(data["attachments"]);
for (int i = 0; i < attachs.Count; i++)
AppendAttachment(new AvatarAttachment((OSDMap)attachs[i]));
{
AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]);
AppendAttachment(att);
// m_log.DebugFormat(
// "[AVATAR APPEARANCE]: Unpacked attachment itemID {0}, assetID {1}, point {2}",
// att.ItemID, att.AssetID, att.AttachPoint);
}
}
}
catch (Exception e)

View File

@@ -66,11 +66,11 @@ namespace OpenSim.Framework
return attachdata;
}
public void Unpack(OSDMap args)
{
if (args["point"] != null)
AttachPoint = args["point"].AsInteger();
ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero;
AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero;
}