aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-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;