refactor: move SP.SaveChangedAttachments() fully into AttachmentsModule
parent
91f59f246f
commit
ddc733cd3d
|
@ -133,6 +133,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveChangedAttachments(IScenePresence sp)
|
||||||
|
{
|
||||||
|
// Need to copy this list because DetachToInventoryPrep mods it
|
||||||
|
List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(sp.Attachments.ToArray());
|
||||||
|
|
||||||
|
foreach (SceneObjectGroup grp in attachments)
|
||||||
|
{
|
||||||
|
if (grp.HasGroupChanged) // Resizer scripts?
|
||||||
|
{
|
||||||
|
grp.IsAttachment = false;
|
||||||
|
grp.AbsolutePosition = grp.RootPart.AttachedPos;
|
||||||
|
// grp.DetachToInventoryPrep();
|
||||||
|
UpdateKnownItem(sp.ControllingClient, grp, grp.GetFromItemID(), grp.OwnerID);
|
||||||
|
grp.IsAttachment = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called by client
|
/// Called by client
|
||||||
|
|
|
@ -41,6 +41,12 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void RezAttachments(IScenePresence sp);
|
void RezAttachments(IScenePresence sp);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Save the attachments that have change on this presence.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sp"></param>
|
||||||
|
void SaveChangedAttachments(IScenePresence sp);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attach an object to an avatar from the world.
|
/// Attach an object to an avatar from the world.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Interfaces
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
|
@ -52,5 +54,14 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
// get a synchronization issue.
|
// get a synchronization issue.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
AvatarAppearance Appearance { get; set; }
|
AvatarAppearance Appearance { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The scene objects attached to this avatar.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Do not change this list directly - use methods such as
|
||||||
|
/// AddAttachment() and RemoveAttachment(). Lock this list when performing any read operations upon it.
|
||||||
|
/// </remarks>
|
||||||
|
List<SceneObjectGroup> Attachments { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3162,8 +3162,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_eventManager.TriggerOnRemovePresence(agentID);
|
m_eventManager.TriggerOnRemovePresence(agentID);
|
||||||
|
|
||||||
if (avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc)
|
if (AttachmentsModule != null && avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc)
|
||||||
avatar.SaveChangedAttachments();
|
AttachmentsModule.SaveChangedAttachments(avatar);
|
||||||
|
|
||||||
ForEachClient(
|
ForEachClient(
|
||||||
delegate(IClientAPI client)
|
delegate(IClientAPI client)
|
||||||
|
|
|
@ -3831,28 +3831,5 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_reprioritization_called = false;
|
m_reprioritization_called = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveChangedAttachments()
|
|
||||||
{
|
|
||||||
// Need to copy this list because DetachToInventoryPrep mods it
|
|
||||||
List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(Attachments.ToArray());
|
|
||||||
|
|
||||||
IAttachmentsModule attachmentsModule = m_scene.AttachmentsModule;
|
|
||||||
if (attachmentsModule != null)
|
|
||||||
{
|
|
||||||
foreach (SceneObjectGroup grp in attachments)
|
|
||||||
{
|
|
||||||
if (grp.HasGroupChanged) // Resizer scripts?
|
|
||||||
{
|
|
||||||
grp.IsAttachment = false;
|
|
||||||
grp.AbsolutePosition = grp.RootPart.AttachedPos;
|
|
||||||
// grp.DetachToInventoryPrep();
|
|
||||||
attachmentsModule.UpdateKnownItem(ControllingClient,
|
|
||||||
grp, grp.GetFromItemID(), grp.OwnerID);
|
|
||||||
grp.IsAttachment = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue