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