aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
diff options
context:
space:
mode:
authorMelanie2012-06-28 03:21:08 +0100
committerMelanie2012-06-28 03:21:08 +0100
commit41a1903c60475fc2d98b1b11d336a3ecee0bc150 (patch)
tree0e78852eee96e9506b815cea0abbd35ac7da7f1a /OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
parentMerge branch 'master' into careminster (diff)
parentAvoid reporting false positives when a colon is in a comment in the first lin... (diff)
downloadopensim-SC-41a1903c60475fc2d98b1b11d336a3ecee0bc150.zip
opensim-SC-41a1903c60475fc2d98b1b11d336a3ecee0bc150.tar.gz
opensim-SC-41a1903c60475fc2d98b1b11d336a3ecee0bc150.tar.bz2
opensim-SC-41a1903c60475fc2d98b1b11d336a3ecee0bc150.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs50
1 files changed, 50 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 54cff55..fcf682b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -102,6 +102,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
102 102
103 #region IAttachmentsModule 103 #region IAttachmentsModule
104 104
105 public void CopyAttachments(IScenePresence sp, AgentData ad)
106 {
107 lock (sp.AttachmentsSyncLock)
108 {
109 // Attachment objects
110 List<SceneObjectGroup> attachments = sp.GetAttachments();
111 if (attachments.Count > 0)
112 {
113 ad.AttachmentObjects = new List<ISceneObject>();
114 ad.AttachmentObjectStates = new List<string>();
115 // IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
116 sp.InTransitScriptStates.Clear();
117
118 foreach (SceneObjectGroup sog in attachments)
119 {
120 // We need to make a copy and pass that copy
121 // because of transfers withn the same sim
122 ISceneObject clone = sog.CloneForNewScene();
123 // Attachment module assumes that GroupPosition holds the offsets...!
124 ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
125 ((SceneObjectGroup)clone).IsAttachment = false;
126 ad.AttachmentObjects.Add(clone);
127 string state = sog.GetStateSnapshot();
128 ad.AttachmentObjectStates.Add(state);
129 sp.InTransitScriptStates.Add(state);
130 // Let's remove the scripts of the original object here
131 sog.RemoveScriptInstances(true);
132 }
133 }
134 }
135 }
136
137 public void CopyAttachments(AgentData ad, IScenePresence sp)
138 {
139 if (ad.AttachmentObjects != null && ad.AttachmentObjects.Count > 0)
140 {
141 lock (sp.AttachmentsSyncLock)
142 sp.ClearAttachments();
143
144 int i = 0;
145 foreach (ISceneObject so in ad.AttachmentObjects)
146 {
147 ((SceneObjectGroup)so).LocalId = 0;
148 ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule();
149 so.SetState(ad.AttachmentObjectStates[i++], m_scene);
150 m_scene.IncomingCreateObject(Vector3.Zero, so);
151 }
152 }
153 }
154
105 /// <summary> 155 /// <summary>
106 /// RezAttachments. This should only be called upon login on the first region. 156 /// RezAttachments. This should only be called upon login on the first region.
107 /// Attachment rezzings on crossings and TPs are done in a different way. 157 /// Attachment rezzings on crossings and TPs are done in a different way.