aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-06-27 00:41:46 +0100
committerJustin Clark-Casey (justincc)2012-06-27 00:41:46 +0100
commitd0432133172f4147f7401f214c703611978423cd (patch)
tree3677b37a4525fc5165c5b5378abe9fbff671aa0e /OpenSim/Region/Framework/Scenes
parentAutomatically disable log4net before each regression test so that logging is ... (diff)
downloadopensim-SC-d0432133172f4147f7401f214c703611978423cd.zip
opensim-SC-d0432133172f4147f7401f214c703611978423cd.tar.gz
opensim-SC-d0432133172f4147f7401f214c703611978423cd.tar.bz2
opensim-SC-d0432133172f4147f7401f214c703611978423cd.tar.xz
refactor: Move ScenePresence <-> AgentData attachments copying code into AttachmentsModule.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs41
1 files changed, 4 insertions, 37 deletions
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)