aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs20
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs12
3 files changed, 21 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 2142d02..7086e6c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
148 } 148 }
149 } 149 }
150 150
151 public void SaveChangedAttachments(IScenePresence sp) 151 public void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted)
152 { 152 {
153// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); 153// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
154 154
@@ -157,13 +157,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
157 157
158 foreach (SceneObjectGroup grp in sp.GetAttachments()) 158 foreach (SceneObjectGroup grp in sp.GetAttachments())
159 { 159 {
160// if (grp.HasGroupChanged) // Resizer scripts? 160 grp.IsAttachment = false;
161// { 161 grp.AbsolutePosition = grp.RootPart.AttachedPos;
162 grp.IsAttachment = false; 162 UpdateKnownItem(sp, grp, saveAllScripted);
163 grp.AbsolutePosition = grp.RootPart.AttachedPos; 163 grp.IsAttachment = true;
164 UpdateKnownItem(sp, grp);
165 grp.IsAttachment = true;
166// }
167 } 164 }
168 } 165 }
169 166
@@ -460,7 +457,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
460 /// </remarks> 457 /// </remarks>
461 /// <param name="sp"></param> 458 /// <param name="sp"></param>
462 /// <param name="grp"></param> 459 /// <param name="grp"></param>
463 private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp) 460 private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, bool saveAllScripted)
464 { 461 {
465 // Saving attachments for NPCs messes them up for the real owner! 462 // Saving attachments for NPCs messes them up for the real owner!
466 INPCModule module = m_scene.RequestModuleInterface<INPCModule>(); 463 INPCModule module = m_scene.RequestModuleInterface<INPCModule>();
@@ -470,7 +467,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
470 return; 467 return;
471 } 468 }
472 469
473 if (grp.HasGroupChanged || grp.ContainsScripts()) 470 if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts()))
474 { 471 {
475 m_log.DebugFormat( 472 m_log.DebugFormat(
476 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", 473 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
@@ -503,6 +500,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
503 if (sp.ControllingClient != null) 500 if (sp.ControllingClient != null)
504 sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0); 501 sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
505 } 502 }
503 grp.HasGroupChanged = false; // Prevent it being saved over and over
506 } 504 }
507 else 505 else
508 { 506 {
@@ -696,7 +694,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
696 group.IsAttachment = false; 694 group.IsAttachment = false;
697 group.AbsolutePosition = group.RootPart.AttachedPos; 695 group.AbsolutePosition = group.RootPart.AttachedPos;
698 696
699 UpdateKnownItem(sp, group); 697 UpdateKnownItem(sp, group, true);
700 m_scene.DeleteSceneObject(group, false); 698 m_scene.DeleteSceneObject(group, false);
701 699
702 return; 700 return;
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index e668dae..eb07165 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Region.Framework.Interfaces
46 /// Save the attachments that have change on this presence. 46 /// Save the attachments that have change on this presence.
47 /// </summary> 47 /// </summary>
48 /// <param name="sp"></param> 48 /// <param name="sp"></param>
49 void SaveChangedAttachments(IScenePresence sp); 49 void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted);
50 50
51 /// <summary> 51 /// <summary>
52 /// Delete all the presence's attachments from the scene 52 /// Delete all the presence's attachments from the scene
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index df6c88f..2af4a1c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3104,7 +3104,17 @@ namespace OpenSim.Region.Framework.Scenes
3104 m_eventManager.TriggerOnRemovePresence(agentID); 3104 m_eventManager.TriggerOnRemovePresence(agentID);
3105 3105
3106 if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc) 3106 if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc)
3107 AttachmentsModule.SaveChangedAttachments(avatar); 3107 {
3108 IUserManagement uMan = RequestModuleInterface<IUserManagement>();
3109 // Don't save attachments for HG visitors, it
3110 // messes up their inventory. When a HG visitor logs
3111 // out on a foreign grid, their attachments will be
3112 // reloaded in the state they were in when they left
3113 // the home grid. This is best anyway as the visited
3114 // grid may use an incompatible script engine.
3115 if (uMan == null || uMan.IsLocalGridUser(avatar.UUID))
3116 AttachmentsModule.SaveChangedAttachments(avatar, false);
3117 }
3108 3118
3109 ForEachClient( 3119 ForEachClient(
3110 delegate(IClientAPI client) 3120 delegate(IClientAPI client)