aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-01-11 02:28:43 +0000
committerJustin Clark-Casey (justincc)2013-01-11 02:28:43 +0000
commit660d36a5b026e8b6862b9a575e9578d6ae1599a2 (patch)
treea1a9d28536b73e1d13fecc3d2f340c4ad33c3471
parentSave attachments on detach/exit if a contained script state has been changed. (diff)
downloadopensim-SC_OLD-660d36a5b026e8b6862b9a575e9578d6ae1599a2.zip
opensim-SC_OLD-660d36a5b026e8b6862b9a575e9578d6ae1599a2.tar.gz
opensim-SC_OLD-660d36a5b026e8b6862b9a575e9578d6ae1599a2.tar.bz2
opensim-SC_OLD-660d36a5b026e8b6862b9a575e9578d6ae1599a2.tar.xz
Implement a workaround solution for saving manual script state changes by the user before logout instead of wrongly removing the script early.
This workaround relies on the fact that a closing client goes inactive before the attachments derez calls happen. This reverts the change to remove scripts too early instead of stopping them, since the the two step stop then remove is necessary to execute the detach event.
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs24
1 files changed, 19 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index f9c2142..8a3eeaa 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -77,8 +77,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
77 if (Enabled) 77 if (Enabled)
78 { 78 {
79 m_scene.EventManager.OnNewClient += SubscribeToClientEvents; 79 m_scene.EventManager.OnNewClient += SubscribeToClientEvents;
80 m_scene.EventManager.OnStartScript += HandleScriptStateChange; 80 m_scene.EventManager.OnStartScript += (localID, itemID) => HandleScriptStateChange(localID, true);
81 m_scene.EventManager.OnStopScript += HandleScriptStateChange; 81 m_scene.EventManager.OnStopScript += (localID, itemID) => HandleScriptStateChange(localID, false);
82 } 82 }
83 83
84 // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI 84 // TODO: Should probably be subscribing to CloseClient too, but this doesn't yet give us IClientAPI
@@ -89,11 +89,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
89 /// </summary> 89 /// </summary>
90 /// <param name='localID'></param> 90 /// <param name='localID'></param>
91 /// <param name='itemID'></param> 91 /// <param name='itemID'></param>
92 private void HandleScriptStateChange(uint localID, UUID itemID) 92 private void HandleScriptStateChange(uint localID, bool started)
93 { 93 {
94 SceneObjectGroup sog = m_scene.GetGroupByPrim(localID); 94 SceneObjectGroup sog = m_scene.GetGroupByPrim(localID);
95 if (sog != null && sog.IsAttachment) 95 if (sog != null && sog.IsAttachment)
96 sog.HasGroupChanged = true; 96 {
97 if (!started)
98 {
99 // FIXME: This is a convoluted way for working out whether the script state has changed to stop
100 // because it has been manually stopped or because the stop was called in UpdateDetachedObject() below
101 // This needs to be handled in a less tangled way.
102 ScenePresence sp = m_scene.GetScenePresence(sog.AttachedAvatar);
103 if (sp.ControllingClient.IsActive)
104 sog.HasGroupChanged = true;
105 }
106 else
107 {
108 sog.HasGroupChanged = true;
109 }
110 }
97 } 111 }
98 112
99 public void RemoveRegion(Scene scene) 113 public void RemoveRegion(Scene scene)
@@ -759,7 +773,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
759 // Remove the object from the scene so no more updates 773 // Remove the object from the scene so no more updates
760 // are sent. Doing this before the below changes will ensure 774 // are sent. Doing this before the below changes will ensure
761 // updates can't cause "HUD artefacts" 775 // updates can't cause "HUD artefacts"
762 m_scene.DeleteSceneObject(so, false); 776 m_scene.DeleteSceneObject(so, false, false);
763 777
764 // Prepare sog for storage 778 // Prepare sog for storage
765 so.AttachedAvatar = UUID.Zero; 779 so.AttachedAvatar = UUID.Zero;