diff options
author | Justin Clark-Casey (justincc) | 2013-03-29 02:21:38 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-03-29 02:21:38 +0000 |
commit | 23ae4c0a4d813763bcc39db7693850a21727d7f2 (patch) | |
tree | c1707918586c71aba48e282ffcd53f0df8cf6e60 | |
parent | Revert "Try eliminating the pause before auto-reteleporting for a megaregion ... (diff) | |
download | opensim-SC_OLD-23ae4c0a4d813763bcc39db7693850a21727d7f2.zip opensim-SC_OLD-23ae4c0a4d813763bcc39db7693850a21727d7f2.tar.gz opensim-SC_OLD-23ae4c0a4d813763bcc39db7693850a21727d7f2.tar.bz2 opensim-SC_OLD-23ae4c0a4d813763bcc39db7693850a21727d7f2.tar.xz |
Fix bug where CHANGED_REGION and/or CHANGED_TELEPORT weren't firing for scripts in attachments.
This was because the script resumption in AttachmentsModule was firing the attach event instead.
Had to reinstate the code in 285bd3a do we can resume the scripts there instead, though the bug existed before its removal.
This is to resolve http://opensimulator.org/mantis/view.php?id=6578
4 files changed, 31 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index b7f4303..29a6478 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -328,7 +328,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
328 | if (!Enabled) | 328 | if (!Enabled) |
329 | return false; | 329 | return false; |
330 | 330 | ||
331 | return AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, true, append); | 331 | return AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, false, append); |
332 | } | 332 | } |
333 | 333 | ||
334 | /// <summary> | 334 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5337835..911a3e4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2739,7 +2739,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2739 | // "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); | 2739 | // "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); |
2740 | 2740 | ||
2741 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2741 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2742 | 2742 | ||
2743 | // We must currently not resume scripts at this stage since AttachmentsModule does not have the | ||
2744 | // information that this is due to a teleport/border cross rather than an ordinary attachment. | ||
2745 | // We currently do this in Scene.MakeRootAgent() instead. | ||
2743 | if (AttachmentsModule != null) | 2746 | if (AttachmentsModule != null) |
2744 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, true); | 2747 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, true); |
2745 | } | 2748 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 27325c5..847df03 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3203,6 +3203,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3203 | /// <param name="events"></param> | 3203 | /// <param name="events"></param> |
3204 | public void SetScriptEvents(UUID scriptid, int events) | 3204 | public void SetScriptEvents(UUID scriptid, int events) |
3205 | { | 3205 | { |
3206 | // m_log.DebugFormat( | ||
3207 | // "[SCENE OBJECT PART]: Set script events for script with id {0} on {1}/{2} to {3} in {4}", | ||
3208 | // scriptid, Name, ParentGroup.Name, events, ParentGroup.Scene.Name); | ||
3209 | |||
3206 | // scriptEvents oldparts; | 3210 | // scriptEvents oldparts; |
3207 | lock (m_scriptEvents) | 3211 | lock (m_scriptEvents) |
3208 | { | 3212 | { |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6591fef..4930a39 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -968,6 +968,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
968 | Scene.AttachmentsModule.RezAttachments(this); | 968 | Scene.AttachmentsModule.RezAttachments(this); |
969 | }); | 969 | }); |
970 | } | 970 | } |
971 | else | ||
972 | { | ||
973 | // We need to restart scripts here so that they receive the correct changed events (CHANGED_TELEPORT | ||
974 | // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently | ||
975 | // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are | ||
976 | // not transporting the required data. | ||
977 | lock (m_attachments) | ||
978 | { | ||
979 | if (HasAttachments()) | ||
980 | { | ||
981 | m_log.DebugFormat( | ||
982 | "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); | ||
983 | |||
984 | // Resume scripts | ||
985 | foreach (SceneObjectGroup sog in m_attachments) | ||
986 | { | ||
987 | sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); | ||
988 | sog.ResumeScripts(); | ||
989 | } | ||
990 | } | ||
991 | } | ||
992 | } | ||
971 | 993 | ||
972 | // send the animations of the other presences to me | 994 | // send the animations of the other presences to me |
973 | m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) | 995 | m_scene.ForEachRootScenePresence(delegate(ScenePresence presence) |