diff options
author | Justin Clark-Casey (justincc) | 2013-01-11 01:46:36 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-01-11 01:46:36 +0000 |
commit | 05ac6d3209afb640926995d252e8513ef3003819 (patch) | |
tree | 4c085af053946755502294dba28367f8918cddb0 /OpenSim/Region/CoreModules/Avatar | |
parent | Fix a regression in the last few scene commands changes where setting these v... (diff) | |
download | opensim-SC-05ac6d3209afb640926995d252e8513ef3003819.zip opensim-SC-05ac6d3209afb640926995d252e8513ef3003819.tar.gz opensim-SC-05ac6d3209afb640926995d252e8513ef3003819.tar.bz2 opensim-SC-05ac6d3209afb640926995d252e8513ef3003819.tar.xz |
Save attachments on detach/exit if a contained script state has been changed.
This involves making Attachments module listen for start/stop script changes.
It also involves removing the script from the region on detach in the same manner as every other DeleteSceneObject() call rather than simply stopping it
This is necessary tue to the bad assymetry of start and stop script triggers but it appears to be the correct behaviour anyway, as detached objects are completely gone from the sim.
Not just in a state where their scripts have been stopped.
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 58ed554..f9c2142 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -75,10 +75,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
75 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); | 75 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); |
76 | 76 | ||
77 | if (Enabled) | 77 | if (Enabled) |
78 | { | ||
78 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 79 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; |
80 | m_scene.EventManager.OnStartScript += HandleScriptStateChange; | ||
81 | m_scene.EventManager.OnStopScript += HandleScriptStateChange; | ||
82 | } | ||
79 | 83 | ||
80 | // 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 |
81 | } | 85 | } |
86 | |||
87 | /// <summary> | ||
88 | /// Listen for client triggered running state changes so that we can persist the script's object if necessary. | ||
89 | /// </summary> | ||
90 | /// <param name='localID'></param> | ||
91 | /// <param name='itemID'></param> | ||
92 | private void HandleScriptStateChange(uint localID, UUID itemID) | ||
93 | { | ||
94 | SceneObjectGroup sog = m_scene.GetGroupByPrim(localID); | ||
95 | if (sog != null && sog.IsAttachment) | ||
96 | sog.HasGroupChanged = true; | ||
97 | } | ||
82 | 98 | ||
83 | public void RemoveRegion(Scene scene) | 99 | public void RemoveRegion(Scene scene) |
84 | { | 100 | { |
@@ -743,7 +759,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
743 | // Remove the object from the scene so no more updates | 759 | // Remove the object from the scene so no more updates |
744 | // are sent. Doing this before the below changes will ensure | 760 | // are sent. Doing this before the below changes will ensure |
745 | // updates can't cause "HUD artefacts" | 761 | // updates can't cause "HUD artefacts" |
746 | m_scene.DeleteSceneObject(so, false, false); | 762 | m_scene.DeleteSceneObject(so, false); |
747 | 763 | ||
748 | // Prepare sog for storage | 764 | // Prepare sog for storage |
749 | so.AttachedAvatar = UUID.Zero; | 765 | so.AttachedAvatar = UUID.Zero; |