From 5c1fa968ab954bec9860023dffc8f68baf3c0620 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 3 Sep 2011 01:11:16 +0100 Subject: 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 --- OpenSim/Framework/AvatarAppearance.cs | 15 +++++++++++++-- OpenSim/Framework/AvatarAttachment.cs | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 7c6295d..aed9087 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -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) diff --git a/OpenSim/Framework/AvatarAttachment.cs b/OpenSim/Framework/AvatarAttachment.cs index c68d78d..07dd385 100644 --- a/OpenSim/Framework/AvatarAttachment.cs +++ b/OpenSim/Framework/AvatarAttachment.cs @@ -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; } -- cgit v1.1