aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs20
1 files changed, 9 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 83beff4..f7e3a59 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
149 } 149 }
150 } 150 }
151 151
152 public void SaveChangedAttachments(IScenePresence sp) 152 public void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted)
153 { 153 {
154// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); 154// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
155 155
@@ -158,13 +158,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
158 158
159 foreach (SceneObjectGroup grp in sp.GetAttachments()) 159 foreach (SceneObjectGroup grp in sp.GetAttachments())
160 { 160 {
161// if (grp.HasGroupChanged) // Resizer scripts? 161 grp.IsAttachment = false;
162// { 162 grp.AbsolutePosition = grp.RootPart.AttachedPos;
163 grp.IsAttachment = false; 163 UpdateKnownItem(sp, grp, saveAllScripted);
164 grp.AbsolutePosition = grp.RootPart.AttachedPos; 164 grp.IsAttachment = true;
165 UpdateKnownItem(sp, grp);
166 grp.IsAttachment = true;
167// }
168 } 165 }
169 } 166 }
170 167
@@ -466,7 +463,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
466 /// </remarks> 463 /// </remarks>
467 /// <param name="sp"></param> 464 /// <param name="sp"></param>
468 /// <param name="grp"></param> 465 /// <param name="grp"></param>
469 private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp) 466 private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, bool saveAllScripted)
470 { 467 {
471 // Saving attachments for NPCs messes them up for the real owner! 468 // Saving attachments for NPCs messes them up for the real owner!
472 INPCModule module = m_scene.RequestModuleInterface<INPCModule>(); 469 INPCModule module = m_scene.RequestModuleInterface<INPCModule>();
@@ -476,7 +473,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
476 return; 473 return;
477 } 474 }
478 475
479 if (grp.HasGroupChanged || grp.ContainsScripts()) 476 if (grp.HasGroupChanged || (saveAllScripted && grp.ContainsScripts()))
480 { 477 {
481 m_log.DebugFormat( 478 m_log.DebugFormat(
482 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", 479 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
@@ -509,6 +506,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
509 if (sp.ControllingClient != null) 506 if (sp.ControllingClient != null)
510 sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0); 507 sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0);
511 } 508 }
509 grp.HasGroupChanged = false; // Prevent it being saved over and over
512 } 510 }
513 else 511 else
514 { 512 {
@@ -702,7 +700,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
702 group.IsAttachment = false; 700 group.IsAttachment = false;
703 group.AbsolutePosition = group.RootPart.AttachedPos; 701 group.AbsolutePosition = group.RootPart.AttachedPos;
704 702
705 UpdateKnownItem(sp, group); 703 UpdateKnownItem(sp, group, true);
706 m_scene.DeleteSceneObject(group, false); 704 m_scene.DeleteSceneObject(group, false);
707 705
708 return; 706 return;