From d96c05a1219a60183f5076f6c6f0bdd320611fd5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 Aug 2016 12:18:01 +0100 Subject: [PATCH] change my previus fix, change xengine to expect SOG and not attachments module, this way not breaking other script engines or modules out there for no valid reason --- .../Avatar/Attachments/AttachmentsModule.cs | 16 +++------------- .../Region/ScriptEngine/XEngine/EventManager.cs | 9 ++++++++- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 1563f26c2a..d227974821 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -599,8 +599,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // this can't be done when creating scripts: // scripts do internal enqueue of attach event // and not all scripts are loaded at this point -// m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); - TriggerGroupOnAttach(group, sp.UUID); + m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); } return true; @@ -760,8 +759,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments sp.ControllingClient.SendRemoveInventoryItem(inventoryID); } - //m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); - TriggerGroupOnAttach(so, UUID.Zero); + m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); // Attach (NULL) stops scripts. We don't want that. Resume them. so.ResumeScripts(); @@ -1058,8 +1056,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments { if (fireDetachEvent) { -// m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero); - TriggerGroupOnAttach(grp, UUID.Zero); + 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); } @@ -1384,13 +1381,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (sp != null) DetachSingleAttachmentToGround(sp, soLocalId); } - - private void TriggerGroupOnAttach(SceneObjectGroup grp, UUID avatarID) - { - UUID item = grp.FromItemID; // this maybe wrong but xengine ignores it - foreach(SceneObjectPart part in grp.Parts) - m_scene.EventManager.TriggerOnAttach(part.LocalId, item, avatarID); - } #endregion } } diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index f1b1e6652e..301eadae42 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -408,10 +408,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine public void attach(uint localID, UUID itemID, UUID avatar) { - myScriptEngine.PostObjectEvent(localID, new EventParams( + SceneObjectGroup grp = myScriptEngine.World.GetSceneObjectGroup(localID); + if(grp == null) + return; + + foreach(SceneObjectPart part in grp.Parts) + { + myScriptEngine.PostObjectEvent(part.LocalId, new EventParams( "attach",new object[] { new LSL_Types.LSLString(avatar.ToString()) }, new DetectParams[0])); + } } // dataserver: not handled here