diff options
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.cs | 50 |
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. |