diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 3c2cc42..f54e41a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -168,6 +168,81 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
168 | 168 | ||
169 | return true; | 169 | return true; |
170 | } | 170 | } |
171 | |||
172 | public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
173 | { | ||
174 | m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name); | ||
175 | |||
176 | return RezSingleAttachmentFromInventory(remoteClient, itemID, AttachmentPt, true); | ||
177 | } | ||
178 | |||
179 | public UUID RezSingleAttachmentFromInventory( | ||
180 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) | ||
181 | { | ||
182 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); | ||
183 | |||
184 | if (updateInventoryStatus) | ||
185 | { | ||
186 | if (att == null) | ||
187 | { | ||
188 | ShowDetachInUserInventory(itemID, remoteClient); | ||
189 | } | ||
190 | |||
191 | SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt); | ||
192 | } | ||
193 | |||
194 | if (null == att) | ||
195 | return UUID.Zero; | ||
196 | else | ||
197 | return att.UUID; | ||
198 | } | ||
199 | |||
200 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | ||
201 | IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
202 | { | ||
203 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | ||
204 | if (invAccess != null) | ||
205 | { | ||
206 | SceneObjectGroup objatt = invAccess.RezObject(remoteClient, | ||
207 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
208 | false, false, remoteClient.AgentId, true); | ||
209 | |||
210 | // m_log.DebugFormat( | ||
211 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | ||
212 | // objatt.Name, remoteClient.Name, AttachmentPt); | ||
213 | |||
214 | if (objatt != null) | ||
215 | { | ||
216 | bool tainted = false; | ||
217 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) | ||
218 | tainted = true; | ||
219 | |||
220 | AttachObject( | ||
221 | remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); | ||
222 | //objatt.ScheduleGroupForFullUpdate(); | ||
223 | |||
224 | if (tainted) | ||
225 | objatt.HasGroupChanged = true; | ||
226 | |||
227 | // Fire after attach, so we don't get messy perms dialogs | ||
228 | // 3 == AttachedRez | ||
229 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); | ||
230 | |||
231 | // Do this last so that event listeners have access to all the effects of the attachment | ||
232 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | ||
233 | } | ||
234 | else | ||
235 | { | ||
236 | m_log.WarnFormat( | ||
237 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | ||
238 | itemID, remoteClient.Name, AttachmentPt); | ||
239 | } | ||
240 | |||
241 | return objatt; | ||
242 | } | ||
243 | |||
244 | return null; | ||
245 | } | ||
171 | 246 | ||
172 | public UUID SetAttachmentInventoryStatus( | 247 | public UUID SetAttachmentInventoryStatus( |
173 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 248 | SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) |