Straighten out some attachment mess. Don't save attachment states for HG
visitors at all. On Leaving a sim, save only the changed ones. Don't save all scripted stuff when leaving a sim.iar_mods
parent
9bd02b5da1
commit
fcc1fa2c32
|
@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveChangedAttachments(IScenePresence sp)
|
public void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
|
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
|
||||||
|
|
||||||
|
@ -157,13 +157,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
|
|
||||||
foreach (SceneObjectGroup grp in sp.GetAttachments())
|
foreach (SceneObjectGroup grp in sp.GetAttachments())
|
||||||
{
|
{
|
||||||
// if (grp.HasGroupChanged) // Resizer scripts?
|
grp.IsAttachment = false;
|
||||||
// {
|
grp.AbsolutePosition = grp.RootPart.AttachedPos;
|
||||||
grp.IsAttachment = false;
|
UpdateKnownItem(sp, grp, saveAllScripted);
|
||||||
grp.AbsolutePosition = grp.RootPart.AttachedPos;
|
grp.IsAttachment = true;
|
||||||
UpdateKnownItem(sp, grp);
|
|
||||||
grp.IsAttachment = true;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +457,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="sp"></param>
|
/// <param name="sp"></param>
|
||||||
/// <param name="grp"></param>
|
/// <param name="grp"></param>
|
||||||
private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp)
|
private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, bool saveAllScripted)
|
||||||
{
|
{
|
||||||
// Saving attachments for NPCs messes them up for the real owner!
|
// Saving attachments for NPCs messes them up for the real owner!
|
||||||
INPCModule module = m_scene.RequestModuleInterface<INPCModule>();
|
INPCModule module = m_scene.RequestModuleInterface<INPCModule>();
|
||||||
|
@ -470,7 +467,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grp.HasGroupChanged || grp.ContainsScripts())
|
if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts()))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
|
"[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
|
||||||
|
@ -696,7 +693,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
group.IsAttachment = false;
|
group.IsAttachment = false;
|
||||||
group.AbsolutePosition = group.RootPart.AttachedPos;
|
group.AbsolutePosition = group.RootPart.AttachedPos;
|
||||||
|
|
||||||
UpdateKnownItem(sp, group);
|
UpdateKnownItem(sp, group, true);
|
||||||
m_scene.DeleteSceneObject(group, false);
|
m_scene.DeleteSceneObject(group, false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -3104,7 +3104,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_eventManager.TriggerOnRemovePresence(agentID);
|
m_eventManager.TriggerOnRemovePresence(agentID);
|
||||||
|
|
||||||
if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc)
|
if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc)
|
||||||
AttachmentsModule.SaveChangedAttachments(avatar);
|
{
|
||||||
|
IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>();
|
||||||
|
// Don't save attachments for HG visitors, it
|
||||||
|
// messes up their inventory. When a HG visitor logs
|
||||||
|
// out on a foreign grid, their attachments will be
|
||||||
|
// reloaded in the state they were in when they left
|
||||||
|
// the home grid. This is best anyway as the visited
|
||||||
|
// grid may use an incompatible script engine.
|
||||||
|
if (uMan == null || uMan.IsLocalGridUser(id))
|
||||||
|
AttachmentsModule.SaveChangedAttachments(avatar, false);
|
||||||
|
}
|
||||||
|
|
||||||
ForEachClient(
|
ForEachClient(
|
||||||
delegate(IClientAPI client)
|
delegate(IClientAPI client)
|
||||||
|
|
Loading…
Reference in New Issue