diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 41 |
3 files changed, 24 insertions, 37 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index fde5de1..375d334 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -36,6 +36,20 @@ namespace OpenSim.Region.Framework.Interfaces | |||
36 | public interface IAttachmentsModule | 36 | public interface IAttachmentsModule |
37 | { | 37 | { |
38 | /// <summary> | 38 | /// <summary> |
39 | /// Copy attachment data from a ScenePresence into the AgentData structure for transmission to another simulator | ||
40 | /// </summary> | ||
41 | /// <param name='sp'></param> | ||
42 | /// <param name='ad'></param> | ||
43 | void CopyAttachments(IScenePresence sp, AgentData ad); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Copy attachment data from an AgentData structure into a ScenePresence. | ||
47 | /// </summary> | ||
48 | /// <param name='ad'></param> | ||
49 | /// <param name='sp'></param> | ||
50 | void CopyAttachments(AgentData ad, IScenePresence sp); | ||
51 | |||
52 | /// <summary> | ||
39 | /// RezAttachments. This should only be called upon login on the first region. | 53 | /// RezAttachments. This should only be called upon login on the first region. |
40 | /// Attachment rezzings on crossings and TPs are done in a different way. | 54 | /// Attachment rezzings on crossings and TPs are done in a different way. |
41 | /// </summary> | 55 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs index 5e43843..19a8236 100644 --- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs +++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs | |||
@@ -41,6 +41,12 @@ namespace OpenSim.Region.Framework.Interfaces | |||
41 | public interface IScenePresence : ISceneAgent | 41 | public interface IScenePresence : ISceneAgent |
42 | { | 42 | { |
43 | /// <summary> | 43 | /// <summary> |
44 | /// 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. | ||
46 | /// </summary> | ||
47 | List<string> InTransitScriptStates { get; } | ||
48 | |||
49 | /// <summary> | ||
44 | /// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments. | 50 | /// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments. |
45 | /// </summary> | 51 | /// </summary> |
46 | /// <remarks> | 52 | /// <remarks> |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 909c7c8..c7a670f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3084,31 +3084,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3084 | } | 3084 | } |
3085 | catch { } | 3085 | catch { } |
3086 | 3086 | ||
3087 | // Attachment objects | 3087 | if (Scene.AttachmentsModule != null) |
3088 | List<SceneObjectGroup> attachments = GetAttachments(); | 3088 | Scene.AttachmentsModule.CopyAttachments(this, cAgent); |
3089 | if (attachments.Count > 0) | ||
3090 | { | ||
3091 | cAgent.AttachmentObjects = new List<ISceneObject>(); | ||
3092 | cAgent.AttachmentObjectStates = new List<string>(); | ||
3093 | // IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>(); | ||
3094 | InTransitScriptStates.Clear(); | ||
3095 | |||
3096 | foreach (SceneObjectGroup sog in attachments) | ||
3097 | { | ||
3098 | // We need to make a copy and pass that copy | ||
3099 | // because of transfers withn the same sim | ||
3100 | ISceneObject clone = sog.CloneForNewScene(); | ||
3101 | // Attachment module assumes that GroupPosition holds the offsets...! | ||
3102 | ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos; | ||
3103 | ((SceneObjectGroup)clone).IsAttachment = false; | ||
3104 | cAgent.AttachmentObjects.Add(clone); | ||
3105 | string state = sog.GetStateSnapshot(); | ||
3106 | cAgent.AttachmentObjectStates.Add(state); | ||
3107 | InTransitScriptStates.Add(state); | ||
3108 | // Let's remove the scripts of the original object here | ||
3109 | sog.RemoveScriptInstances(true); | ||
3110 | } | ||
3111 | } | ||
3112 | } | 3089 | } |
3113 | 3090 | ||
3114 | private void CopyFrom(AgentData cAgent) | 3091 | private void CopyFrom(AgentData cAgent) |
@@ -3178,18 +3155,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3178 | if (cAgent.Anims != null) | 3155 | if (cAgent.Anims != null) |
3179 | Animator.Animations.FromArray(cAgent.Anims); | 3156 | Animator.Animations.FromArray(cAgent.Anims); |
3180 | 3157 | ||
3181 | if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) | 3158 | if (Scene.AttachmentsModule != null) |
3182 | { | 3159 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); |
3183 | m_attachments = new List<SceneObjectGroup>(); | ||
3184 | int i = 0; | ||
3185 | foreach (ISceneObject so in cAgent.AttachmentObjects) | ||
3186 | { | ||
3187 | ((SceneObjectGroup)so).LocalId = 0; | ||
3188 | ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule(); | ||
3189 | so.SetState(cAgent.AttachmentObjectStates[i++], m_scene); | ||
3190 | m_scene.IncomingCreateObject(Vector3.Zero, so); | ||
3191 | } | ||
3192 | } | ||
3193 | } | 3160 | } |
3194 | 3161 | ||
3195 | public bool CopyAgent(out IAgentData agent) | 3162 | public bool CopyAgent(out IAgentData agent) |