diff options
author | Justin Clark-Casey (justincc) | 2013-03-18 22:04:27 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-03-18 22:04:27 +0000 |
commit | 3611d33b00650ccc71994b331e4c6595f95d3131 (patch) | |
tree | c288d22ce1378fc78ba6c3fce8f04f1a6ae04c04 /OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |
parent | Fix recent regression where an item worn to an attachment point that was alre... (diff) | |
download | opensim-SC_OLD-3611d33b00650ccc71994b331e4c6595f95d3131.zip opensim-SC_OLD-3611d33b00650ccc71994b331e4c6595f95d3131.tar.gz opensim-SC_OLD-3611d33b00650ccc71994b331e4c6595f95d3131.tar.bz2 opensim-SC_OLD-3611d33b00650ccc71994b331e4c6595f95d3131.tar.xz |
Improve rejection of any attempt to reattach an object that is already attached.
This also adds/extends regression tests for wearing attachments directly for the scene and attempting to reattach/rewear already attached objects.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2092d6f..1c28f49 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -305,6 +305,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
305 | private bool AttachObjectInternal( | 305 | private bool AttachObjectInternal( |
306 | IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool temp, bool resumeScripts) | 306 | IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool temp, bool resumeScripts) |
307 | { | 307 | { |
308 | if (sp.GetAttachments().Contains(group)) | ||
309 | { | ||
310 | // m_log.WarnFormat( | ||
311 | // "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached", | ||
312 | // group.Name, group.LocalId, sp.Name, AttachmentPt); | ||
313 | |||
314 | return false; | ||
315 | } | ||
316 | |||
308 | // m_log.DebugFormat( | 317 | // m_log.DebugFormat( |
309 | // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", | 318 | // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", |
310 | // group.Name, group.LocalId, sp.Name, attachmentPt, silent); | 319 | // group.Name, group.LocalId, sp.Name, attachmentPt, silent); |
@@ -318,15 +327,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
318 | return false; | 327 | return false; |
319 | } | 328 | } |
320 | 329 | ||
321 | if (sp.GetAttachments(attachmentPt).Contains(group)) | ||
322 | { | ||
323 | // m_log.WarnFormat( | ||
324 | // "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached", | ||
325 | // group.Name, group.LocalId, sp.Name, AttachmentPt); | ||
326 | |||
327 | return false; | ||
328 | } | ||
329 | |||
330 | Vector3 attachPos = group.AbsolutePosition; | 330 | Vector3 attachPos = group.AbsolutePosition; |
331 | 331 | ||
332 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should | 332 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should |
@@ -336,13 +336,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
336 | // If the attachment point isn't the same as the one previously used | 336 | // If the attachment point isn't the same as the one previously used |
337 | // set it's offset position = 0 so that it appears on the attachment point | 337 | // set it's offset position = 0 so that it appears on the attachment point |
338 | // and not in a weird location somewhere unknown. | 338 | // and not in a weird location somewhere unknown. |
339 | if (attachmentPt != 0 && attachmentPt != group.AttachmentPoint) | 339 | if (attachmentPt != (uint)AttachmentPoint.Default && attachmentPt != group.AttachmentPoint) |
340 | { | 340 | { |
341 | attachPos = Vector3.Zero; | 341 | attachPos = Vector3.Zero; |
342 | } | 342 | } |
343 | 343 | ||
344 | // AttachmentPt 0 means the client chose to 'wear' the attachment. | 344 | // AttachmentPt 0 (default) means the client chose to 'wear' the attachment. |
345 | if (attachmentPt == 0) | 345 | if (attachmentPt == (uint)AttachmentPoint.Default) |
346 | { | 346 | { |
347 | // Check object for stored attachment point | 347 | // Check object for stored attachment point |
348 | attachmentPt = group.AttachmentPoint; | 348 | attachmentPt = group.AttachmentPoint; |