mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
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:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user