diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d34a8f6..0f3b1e8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -690,18 +690,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
690 | m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); | 690 | m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); |
691 | sp.RemoveAttachment(so); | 691 | sp.RemoveAttachment(so); |
692 | 692 | ||
693 | // We can only remove the script instances from the script engine after we've retrieved their xml state | ||
694 | // when we update the attachment item. | ||
695 | m_scene.DeleteSceneObject(so, false, false); | ||
696 | |||
697 | // Prepare sog for storage | 693 | // Prepare sog for storage |
698 | so.AttachedAvatar = UUID.Zero; | 694 | so.AttachedAvatar = UUID.Zero; |
699 | so.RootPart.SetParentLocalId(0); | 695 | so.RootPart.SetParentLocalId(0); |
700 | so.IsAttachment = false; | 696 | so.IsAttachment = false; |
701 | so.AbsolutePosition = so.RootPart.AttachedPos; | 697 | |
698 | // We cannot use AbsolutePosition here because that would | ||
699 | // attempt to cross the prim as it is detached | ||
700 | so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); | ||
702 | 701 | ||
703 | UpdateKnownItem(sp, so, true); | 702 | UpdateKnownItem(sp, so, true); |
704 | so.RemoveScriptInstances(true); | 703 | |
704 | // This MUST happen AFTER serialization because it will | ||
705 | // either stop or remove the scripts. Both will cause scripts | ||
706 | // to be serialized in a stopped state with the true run | ||
707 | // state already lost. | ||
708 | m_scene.DeleteSceneObject(so, false, true); | ||
705 | } | 709 | } |
706 | 710 | ||
707 | private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 711 | private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |