diff options
author | Diva Canto | 2011-05-04 12:04:35 -0700 |
---|---|---|
committer | Diva Canto | 2011-05-04 12:04:35 -0700 |
commit | 6c503e75acb459e4cdda423bbfbf4cb22611315e (patch) | |
tree | e01ebff20708bd4b27cf4aafabc86624339f08d9 | |
parent | Fixes mantis #5461. (diff) | |
download | opensim-SC_OLD-6c503e75acb459e4cdda423bbfbf4cb22611315e.zip opensim-SC_OLD-6c503e75acb459e4cdda423bbfbf4cb22611315e.tar.gz opensim-SC_OLD-6c503e75acb459e4cdda423bbfbf4cb22611315e.tar.bz2 opensim-SC_OLD-6c503e75acb459e4cdda423bbfbf4cb22611315e.tar.xz |
Put the previous state back in the attachments in case the agent transfer fails.
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b985fbb..e380067 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1759,11 +1759,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1759 | 1759 | ||
1760 | protected void ReInstantiateScripts(ScenePresence sp) | 1760 | protected void ReInstantiateScripts(ScenePresence sp) |
1761 | { | 1761 | { |
1762 | int i = 0; | ||
1762 | sp.Attachments.ForEach(delegate(SceneObjectGroup sog) | 1763 | sp.Attachments.ForEach(delegate(SceneObjectGroup sog) |
1763 | { | 1764 | { |
1765 | sog.SetState(sp.InTransitScriptStates[i++], sp.Scene); | ||
1764 | sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0); | 1766 | sog.CreateScriptInstances(0, false, sp.Scene.DefaultScriptEngine, 0); |
1765 | sog.ResumeScripts(); | 1767 | sog.ResumeScripts(); |
1766 | }); | 1768 | }); |
1769 | |||
1770 | sp.InTransitScriptStates.Clear(); | ||
1767 | } | 1771 | } |
1768 | #endregion | 1772 | #endregion |
1769 | 1773 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1e90d56..631c91b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -232,6 +232,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
232 | private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); | 232 | private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); |
233 | 233 | ||
234 | /// <summary> | 234 | /// <summary> |
235 | /// Copy of the script states while the agent is in transit. This state may | ||
236 | /// need to be placed back in case of transfer fail. | ||
237 | /// </summary> | ||
238 | public List<string> InTransitScriptStates | ||
239 | { | ||
240 | get { return m_InTransitScriptStates; } | ||
241 | } | ||
242 | private List<string> m_InTransitScriptStates = new List<string>(); | ||
243 | |||
244 | /// <summary> | ||
235 | /// Implemented Control Flags | 245 | /// Implemented Control Flags |
236 | /// </summary> | 246 | /// </summary> |
237 | private enum Dir_ControlFlags | 247 | private enum Dir_ControlFlags |
@@ -3142,6 +3152,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3142 | cAgent.AttachmentObjects = new List<ISceneObject>(); | 3152 | cAgent.AttachmentObjects = new List<ISceneObject>(); |
3143 | cAgent.AttachmentObjectStates = new List<string>(); | 3153 | cAgent.AttachmentObjectStates = new List<string>(); |
3144 | IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>(); | 3154 | IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>(); |
3155 | m_InTransitScriptStates.Clear(); | ||
3145 | foreach (SceneObjectGroup sog in m_attachments) | 3156 | foreach (SceneObjectGroup sog in m_attachments) |
3146 | { | 3157 | { |
3147 | // We need to make a copy and pass that copy | 3158 | // We need to make a copy and pass that copy |
@@ -3151,7 +3162,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3151 | ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; | 3162 | ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; |
3152 | ((SceneObjectGroup)clone).RootPart.IsAttachment = false; | 3163 | ((SceneObjectGroup)clone).RootPart.IsAttachment = false; |
3153 | cAgent.AttachmentObjects.Add(clone); | 3164 | cAgent.AttachmentObjects.Add(clone); |
3154 | cAgent.AttachmentObjectStates.Add(sog.GetStateSnapshot()); | 3165 | string state = sog.GetStateSnapshot(); |
3166 | cAgent.AttachmentObjectStates.Add(state); | ||
3167 | m_InTransitScriptStates.Add(state); | ||
3155 | // Let's remove the scripts of the original object here | 3168 | // Let's remove the scripts of the original object here |
3156 | sog.RemoveScriptInstances(true); | 3169 | sog.RemoveScriptInstances(true); |
3157 | } | 3170 | } |