From 5e09e52ee99a1646abbf83a4bf8d57655241d2f5 Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Tue, 26 May 2015 00:38:07 +0100 Subject: [PATCH] Attachments Module. Fix detach event not being fired until the next time the object is attached. Not an ideal fix but this allows scripts such as AOs to remove animations when detached etc. The pause added does not affect other avatars or the scene in general and only pauses the avatar performing the detach for an extra 2 milliseconds. Signed-off-by: Diva Canto --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 8705dd57af..77abcd7091 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -929,8 +929,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments private string PrepareScriptInstanceForSave(SceneObjectGroup grp, bool fireDetachEvent) { if (fireDetachEvent) + { m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero); + // Allow detach event time to do some work before stopping the script + Thread.Sleep(2); + } + using (StringWriter sw = new StringWriter()) { using (XmlTextWriter writer = new XmlTextWriter(sw))