diff options
author | Melanie | 2012-07-23 21:08:02 +0200 |
---|---|---|
committer | Melanie | 2012-07-23 21:08:02 +0200 |
commit | 9e00e2ddecdafa489de0ae67b78cf6971e55fe80 (patch) | |
tree | d2a9fdc3424a7dca00a1612399b25a3db0ac76a5 /OpenSim/Region/Framework | |
parent | Fix double-ping on logout by not sending a stop packet to the client (diff) | |
download | opensim-SC_OLD-9e00e2ddecdafa489de0ae67b78cf6971e55fe80.zip opensim-SC_OLD-9e00e2ddecdafa489de0ae67b78cf6971e55fe80.tar.gz opensim-SC_OLD-9e00e2ddecdafa489de0ae67b78cf6971e55fe80.tar.bz2 opensim-SC_OLD-9e00e2ddecdafa489de0ae67b78cf6971e55fe80.tar.xz |
Change attachment handling to remove object from the scene first as per
justincc's original work. Sample scripts before doing so. Also refactor some
crucial common code and eliminate parameters that were only ever used with
the same constant value.
Diffstat (limited to 'OpenSim/Region/Framework')
4 files changed, 23 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 410eda0..11a13e1 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
66 | /// <param name="sp">The presence closing</param> | 66 | /// <param name="sp">The presence closing</param> |
67 | /// <param name="saveChanged">Save changed attachments.</param> | 67 | /// <param name="saveChanged">Save changed attachments.</param> |
68 | /// <param name="saveAllScripted">Save attachments with scripts even if they haven't changed.</para> | 68 | /// <param name="saveAllScripted">Save attachments with scripts even if they haven't changed.</para> |
69 | void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted); | 69 | void DeRezAttachments(IScenePresence sp); |
70 | 70 | ||
71 | /// <summary> | 71 | /// <summary> |
72 | /// Delete all the presence's attachments from the scene | 72 | /// Delete all the presence's attachments from the scene |
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs index e6b926c..3f68ee0 100644 --- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs +++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs | |||
@@ -40,6 +40,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
40 | /// </remarks> | 40 | /// </remarks> |
41 | public interface IScenePresence : ISceneAgent | 41 | public interface IScenePresence : ISceneAgent |
42 | { | 42 | { |
43 | PresenceType PresenceType { get; } | ||
44 | |||
43 | /// <summary> | 45 | /// <summary> |
44 | /// Copy of the script states while the agent is in transit. This state may | 46 | /// Copy of the script states while the agent is in transit. This state may |
45 | /// need to be placed back in case of transfer fail. | 47 | /// need to be placed back in case of transfer fail. |
@@ -83,4 +85,4 @@ namespace OpenSim.Region.Framework.Interfaces | |||
83 | void RemoveAttachment(SceneObjectGroup gobj); | 85 | void RemoveAttachment(SceneObjectGroup gobj); |
84 | void ClearAttachments(); | 86 | void ClearAttachments(); |
85 | } | 87 | } |
86 | } \ No newline at end of file | 88 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f501828..ad9e91d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3461,17 +3461,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3461 | { | 3461 | { |
3462 | if (AttachmentsModule != null) | 3462 | if (AttachmentsModule != null) |
3463 | { | 3463 | { |
3464 | // Don't save attachments for HG visitors, it | 3464 | AttachmentsModule.DeRezAttachments(avatar); |
3465 | // messes up their inventory. When a HG visitor logs | ||
3466 | // out on a foreign grid, their attachments will be | ||
3467 | // reloaded in the state they were in when they left | ||
3468 | // the home grid. This is best anyway as the visited | ||
3469 | // grid may use an incompatible script engine. | ||
3470 | bool saveChanged | ||
3471 | = avatar.PresenceType != PresenceType.Npc | ||
3472 | && (UserManagementModule == null || UserManagementModule.IsLocalGridUser(avatar.UUID)); | ||
3473 | |||
3474 | AttachmentsModule.DeRezAttachments(avatar, saveChanged, false); | ||
3475 | } | 3465 | } |
3476 | 3466 | ||
3477 | ForEachClient( | 3467 | ForEachClient( |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 2372d6b..0d292e7 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -151,6 +151,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
151 | ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false); | 151 | ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false); |
152 | } | 152 | } |
153 | 153 | ||
154 | public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, string scriptedState) | ||
155 | { | ||
156 | using (StringWriter sw = new StringWriter()) | ||
157 | { | ||
158 | using (XmlTextWriter writer = new XmlTextWriter(sw)) | ||
159 | { | ||
160 | writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); | ||
161 | |||
162 | ToOriginalXmlFormat(sceneObject, writer, false, true); | ||
163 | |||
164 | writer.WriteRaw(scriptedState); | ||
165 | |||
166 | writer.WriteEndElement(); | ||
167 | } | ||
168 | return sw.ToString(); | ||
169 | } | ||
170 | } | ||
171 | |||
154 | /// <summary> | 172 | /// <summary> |
155 | /// Serialize a scene object to the original xml format | 173 | /// Serialize a scene object to the original xml format |
156 | /// </summary> | 174 | /// </summary> |