diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index c05ef3c..54cff55 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -198,31 +198,40 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | public void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted) | 201 | public void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted) |
202 | { | 202 | { |
203 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); | ||
204 | |||
205 | if (!Enabled) | 203 | if (!Enabled) |
206 | return; | 204 | return; |
207 | 205 | ||
208 | foreach (SceneObjectGroup grp in sp.GetAttachments()) | 206 | // m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name); |
207 | |||
208 | lock (sp.AttachmentsSyncLock) | ||
209 | { | 209 | { |
210 | grp.IsAttachment = false; | 210 | foreach (SceneObjectGroup grp in sp.GetAttachments()) |
211 | grp.AbsolutePosition = grp.RootPart.AttachedPos; | 211 | { |
212 | UpdateKnownItem(sp, grp, saveAllScripted); | 212 | grp.Scene.DeleteSceneObject(grp, false); |
213 | grp.IsAttachment = true; | 213 | |
214 | if (saveChanged || saveAllScripted) | ||
215 | { | ||
216 | grp.IsAttachment = false; | ||
217 | grp.AbsolutePosition = grp.RootPart.AttachedPos; | ||
218 | UpdateKnownItem(sp, grp, saveAllScripted); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | sp.ClearAttachments(); | ||
214 | } | 223 | } |
215 | } | 224 | } |
216 | 225 | ||
217 | public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) | 226 | public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) |
218 | { | 227 | { |
219 | // m_log.DebugFormat( | ||
220 | // "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", | ||
221 | // m_scene.RegionInfo.RegionName, sp.Name, silent); | ||
222 | |||
223 | if (!Enabled) | 228 | if (!Enabled) |
224 | return; | 229 | return; |
225 | 230 | ||
231 | // m_log.DebugFormat( | ||
232 | // "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}", | ||
233 | // m_scene.RegionInfo.RegionName, sp.Name, silent); | ||
234 | |||
226 | foreach (SceneObjectGroup sop in sp.GetAttachments()) | 235 | foreach (SceneObjectGroup sop in sp.GetAttachments()) |
227 | { | 236 | { |
228 | sop.Scene.DeleteSceneObject(sop, silent); | 237 | sop.Scene.DeleteSceneObject(sop, silent); |
@@ -477,17 +486,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
477 | if (!Enabled) | 486 | if (!Enabled) |
478 | return; | 487 | return; |
479 | 488 | ||
480 | // First we save the | ||
481 | // attachment point information, then we update the relative | ||
482 | // positioning. Then we have to mark the object as NOT an | ||
483 | // attachment. This is necessary in order to correctly save | ||
484 | // and retrieve GroupPosition information for the attachment. | ||
485 | // Finally, we restore the object's attachment status. | ||
486 | uint attachmentPoint = sog.AttachmentPoint; | ||
487 | sog.UpdateGroupPosition(pos); | 489 | sog.UpdateGroupPosition(pos); |
488 | sog.IsAttachment = false; | ||
489 | sog.AbsolutePosition = sog.RootPart.AttachedPos; | ||
490 | sog.AttachmentPoint = attachmentPoint; | ||
491 | sog.HasGroupChanged = true; | 490 | sog.HasGroupChanged = true; |
492 | } | 491 | } |
493 | 492 | ||
@@ -770,6 +769,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
770 | { | 769 | { |
771 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 770 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
772 | sp.RemoveAttachment(group); | 771 | sp.RemoveAttachment(group); |
772 | m_scene.DeleteSceneObject(group, false); | ||
773 | 773 | ||
774 | // Prepare sog for storage | 774 | // Prepare sog for storage |
775 | group.AttachedAvatar = UUID.Zero; | 775 | group.AttachedAvatar = UUID.Zero; |
@@ -778,7 +778,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
778 | group.AbsolutePosition = group.RootPart.AttachedPos; | 778 | group.AbsolutePosition = group.RootPart.AttachedPos; |
779 | 779 | ||
780 | UpdateKnownItem(sp, group, true); | 780 | UpdateKnownItem(sp, group, true); |
781 | m_scene.DeleteSceneObject(group, false); | ||
782 | 781 | ||
783 | return; | 782 | return; |
784 | } | 783 | } |