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 c679a7b..860bdcd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -759,18 +759,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
759 | m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); | 759 | m_scene.EventManager.TriggerOnAttach(so.LocalId, so.FromItemID, UUID.Zero); |
760 | sp.RemoveAttachment(so); | 760 | sp.RemoveAttachment(so); |
761 | 761 | ||
762 | // We can only remove the script instances from the script engine after we've retrieved their xml state | ||
763 | // when we update the attachment item. | ||
764 | m_scene.DeleteSceneObject(so, false, false); | ||
765 | |||
766 | // Prepare sog for storage | 762 | // Prepare sog for storage |
767 | so.AttachedAvatar = UUID.Zero; | 763 | so.AttachedAvatar = UUID.Zero; |
768 | so.RootPart.SetParentLocalId(0); | 764 | so.RootPart.SetParentLocalId(0); |
769 | so.IsAttachment = false; | 765 | so.IsAttachment = false; |
770 | so.AbsolutePosition = so.RootPart.AttachedPos; | 766 | |
767 | // We cannot use AbsolutePosition here because that would | ||
768 | // attempt to cross the prim as it is detached | ||
769 | so.ForEachPart(x => { x.GroupPosition = so.RootPart.AttachedPos; }); | ||
771 | 770 | ||
772 | UpdateKnownItem(sp, so, true); | 771 | UpdateKnownItem(sp, so, true); |
773 | so.RemoveScriptInstances(true); | 772 | |
773 | // This MUST happen AFTER serialization because it will | ||
774 | // either stop or remove the scripts. Both will cause scripts | ||
775 | // to be serialized in a stopped state with the true run | ||
776 | // state already lost. | ||
777 | m_scene.DeleteSceneObject(so, false, true); | ||
774 | } | 778 | } |
775 | 779 | ||
776 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 780 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |