diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 194 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 14 |
2 files changed, 152 insertions, 56 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2f67c4e..92beed2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Region.Framework; | |||
41 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
43 | using OpenSim.Region.Framework.Scenes.Serialization; | 43 | using OpenSim.Region.Framework.Scenes.Serialization; |
44 | using OpenSim.Services.Interfaces; | ||
44 | 45 | ||
45 | namespace OpenSim.Region.CoreModules.Avatar.Attachments | 46 | namespace OpenSim.Region.CoreModules.Avatar.Attachments |
46 | { | 47 | { |
@@ -303,6 +304,40 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
303 | if (DebugLevel > 0) | 304 | if (DebugLevel > 0) |
304 | m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0} from simulator-side", sp.Name); | 305 | m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0} from simulator-side", sp.Name); |
305 | 306 | ||
307 | XmlDocument doc = new XmlDocument(); | ||
308 | string stateData = String.Empty; | ||
309 | |||
310 | IAttachmentsService attServ = m_scene.RequestModuleInterface<IAttachmentsService>(); | ||
311 | if (attServ != null) | ||
312 | { | ||
313 | m_log.DebugFormat("[ATTACHMENT]: Loading attachment data from attachment service"); | ||
314 | stateData = attServ.Get(sp.UUID.ToString()); | ||
315 | if (stateData != String.Empty) | ||
316 | { | ||
317 | try | ||
318 | { | ||
319 | doc.LoadXml(stateData); | ||
320 | } | ||
321 | catch { } | ||
322 | } | ||
323 | } | ||
324 | |||
325 | Dictionary<UUID, string> itemData = new Dictionary<UUID, string>(); | ||
326 | |||
327 | XmlNodeList nodes = doc.GetElementsByTagName("Attachment"); | ||
328 | if (nodes.Count > 0) | ||
329 | { | ||
330 | foreach (XmlNode n in nodes) | ||
331 | { | ||
332 | XmlElement elem = (XmlElement)n; | ||
333 | string itemID = elem.GetAttribute("ItemID"); | ||
334 | string xml = elem.InnerXml; | ||
335 | |||
336 | itemData[new UUID(itemID)] = xml; | ||
337 | } | ||
338 | } | ||
339 | |||
340 | |||
306 | List<AvatarAttachment> attachments = sp.Appearance.GetAttachments(); | 341 | List<AvatarAttachment> attachments = sp.Appearance.GetAttachments(); |
307 | 342 | ||
308 | // Let's get all items at once, so they get cached | 343 | // Let's get all items at once, so they get cached |
@@ -330,10 +365,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
330 | 365 | ||
331 | try | 366 | try |
332 | { | 367 | { |
368 | string xmlData; | ||
369 | XmlDocument d = null; | ||
370 | UUID asset; | ||
371 | if (itemData.TryGetValue(attach.ItemID, out xmlData)) | ||
372 | { | ||
373 | d = new XmlDocument(); | ||
374 | d.LoadXml(xmlData); | ||
375 | m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", attach.ItemID); | ||
376 | } | ||
377 | |||
333 | // If we're an NPC then skip all the item checks and manipulations since we don't have an | 378 | // If we're an NPC then skip all the item checks and manipulations since we don't have an |
334 | // inventory right now. | 379 | // inventory right now. |
335 | RezSingleAttachmentFromInventoryInternal( | 380 | RezSingleAttachmentFromInventoryInternal( |
336 | sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, attachmentPt, true); | 381 | sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, attachmentPt, true, d); |
337 | } | 382 | } |
338 | catch (Exception e) | 383 | catch (Exception e) |
339 | { | 384 | { |
@@ -361,27 +406,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
361 | 406 | ||
362 | Dictionary<SceneObjectGroup, string> scriptStates = new Dictionary<SceneObjectGroup, string>(); | 407 | Dictionary<SceneObjectGroup, string> scriptStates = new Dictionary<SceneObjectGroup, string>(); |
363 | 408 | ||
364 | foreach (SceneObjectGroup so in attachments) | ||
365 | { | ||
366 | // Scripts MUST be snapshotted before the object is | ||
367 | // removed from the scene because doing otherwise will | ||
368 | // clobber the run flag | ||
369 | // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from | ||
370 | // scripts performing attachment operations at the same time. Getting object states stops the scripts. | ||
371 | scriptStates[so] = PrepareScriptInstanceForSave(so, false); | ||
372 | 409 | ||
373 | // m_log.DebugFormat( | 410 | if (sp.PresenceType != PresenceType.Npc) |
374 | // "[ATTACHMENTS MODULE]: For object {0} for {1} in {2} got saved state {3}", | ||
375 | // so.Name, sp.Name, m_scene.Name, scriptStates[so]); | ||
376 | } | ||
377 | |||
378 | lock (sp.AttachmentsSyncLock) | ||
379 | { | 411 | { |
380 | foreach (SceneObjectGroup so in attachments) | 412 | foreach (SceneObjectGroup so in attachments) |
381 | UpdateDetachedObject(sp, so, scriptStates[so]); | 413 | { |
382 | 414 | // Scripts MUST be snapshotted before the object is | |
383 | sp.ClearAttachments(); | 415 | // removed from the scene because doing otherwise will |
416 | // clobber the run flag | ||
417 | // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from | ||
418 | // scripts performing attachment operations at the same time. Getting object states stops the scripts. | ||
419 | scriptStates[so] = PrepareScriptInstanceForSave(so, false); | ||
420 | } | ||
421 | |||
422 | lock (sp.AttachmentsSyncLock) | ||
423 | { | ||
424 | foreach (SceneObjectGroup so in attachments) | ||
425 | UpdateDetachedObject(sp, so, scriptStates[so]); | ||
426 | sp.ClearAttachments(); | ||
427 | } | ||
384 | } | 428 | } |
429 | else | ||
430 | { | ||
431 | lock (sp.AttachmentsSyncLock) | ||
432 | { | ||
433 | foreach (SceneObjectGroup so in attachments) | ||
434 | UpdateDetachedObject(sp, so, String.Empty); | ||
435 | sp.ClearAttachments(); | ||
436 | } | ||
437 | } | ||
385 | } | 438 | } |
386 | 439 | ||
387 | public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) | 440 | public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) |
@@ -402,20 +455,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
402 | sp.ClearAttachments(); | 455 | sp.ClearAttachments(); |
403 | } | 456 | } |
404 | 457 | ||
405 | public bool AttachObject( | 458 | public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool addToInventory, bool append) |
406 | IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool addToInventory, bool append) | ||
407 | { | 459 | { |
408 | if (!Enabled) | 460 | if (!Enabled) |
409 | return false; | 461 | return false; |
410 | 462 | ||
411 | group.DetachFromBackup(); | 463 | return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, addToInventory, false, append); |
412 | |||
413 | bool success = AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, false, append); | ||
414 | |||
415 | if (!success) | ||
416 | group.AttachToBackup(); | ||
417 | |||
418 | return success; | ||
419 | } | 464 | } |
420 | 465 | ||
421 | /// <summary> | 466 | /// <summary> |
@@ -428,10 +473,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
428 | /// <param name='silent'></param> | 473 | /// <param name='silent'></param> |
429 | /// <param name='addToInventory'>If true then add object to user inventory.</param> | 474 | /// <param name='addToInventory'>If true then add object to user inventory.</param> |
430 | /// <param name='resumeScripts'>If true then scripts are resumed on the attached object.</param> | 475 | /// <param name='resumeScripts'>If true then scripts are resumed on the attached object.</param> |
431 | /// <param name='append'>Append to attachment point rather than replace.</param> | 476 | private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool addToInventory, bool resumeScripts, bool append) |
432 | private bool AttachObjectInternal( | ||
433 | IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool addToInventory, bool resumeScripts, bool append) | ||
434 | { | 477 | { |
478 | // m_log.DebugFormat( | ||
479 | // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", | ||
480 | // group.Name, group.LocalId, sp.Name, attachmentPt, silent); | ||
481 | |||
482 | if (sp.GetAttachments().Contains(group)) | ||
483 | { | ||
484 | // m_log.WarnFormat( | ||
485 | // "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached", | ||
486 | // group.Name, group.LocalId, sp.Name, AttachmentPt); | ||
487 | |||
488 | return false; | ||
489 | } | ||
490 | |||
435 | if (group.GetSittingAvatarsCount() != 0) | 491 | if (group.GetSittingAvatarsCount() != 0) |
436 | { | 492 | { |
437 | if (DebugLevel > 0) | 493 | if (DebugLevel > 0) |
@@ -443,6 +499,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
443 | } | 499 | } |
444 | 500 | ||
445 | Vector3 attachPos = group.AbsolutePosition; | 501 | Vector3 attachPos = group.AbsolutePosition; |
502 | |||
503 | // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should | ||
504 | // be removed when that functionality is implemented in opensim | ||
505 | attachmentPt &= 0x7f; | ||
506 | |||
446 | // If the attachment point isn't the same as the one previously used | 507 | // If the attachment point isn't the same as the one previously used |
447 | // set it's offset position = 0 so that it appears on the attachment point | 508 | // set it's offset position = 0 so that it appears on the attachment point |
448 | // and not in a weird location somewhere unknown. | 509 | // and not in a weird location somewhere unknown. |
@@ -481,9 +542,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
481 | attachPos = Vector3.Zero; | 542 | attachPos = Vector3.Zero; |
482 | } | 543 | } |
483 | 544 | ||
484 | group.AttachmentPoint = attachmentPt; | ||
485 | group.AbsolutePosition = attachPos; | ||
486 | |||
487 | List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt); | 545 | List<SceneObjectGroup> attachments = sp.GetAttachments(attachmentPt); |
488 | 546 | ||
489 | if (attachments.Contains(group)) | 547 | if (attachments.Contains(group)) |
@@ -516,6 +574,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
516 | 574 | ||
517 | lock (sp.AttachmentsSyncLock) | 575 | lock (sp.AttachmentsSyncLock) |
518 | { | 576 | { |
577 | group.AttachmentPoint = attachmentPt; | ||
578 | group.AbsolutePosition = attachPos; | ||
579 | |||
519 | if (addToInventory && sp.PresenceType != PresenceType.Npc) | 580 | if (addToInventory && sp.PresenceType != PresenceType.Npc) |
520 | UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append); | 581 | UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append); |
521 | 582 | ||
@@ -546,7 +607,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
546 | ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group, append); | 607 | ShowAttachInUserInventory(sp, attachmentPt, newAttachmentItemID, group, append); |
547 | } | 608 | } |
548 | 609 | ||
549 | public SceneObjectGroup RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt) | 610 | public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt) |
611 | { | ||
612 | return RezSingleAttachmentFromInventory(sp, itemID, AttachmentPt, null); | ||
613 | } | ||
614 | |||
615 | public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt, XmlDocument doc) | ||
550 | { | 616 | { |
551 | if (!Enabled) | 617 | if (!Enabled) |
552 | return null; | 618 | return null; |
@@ -584,7 +650,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
584 | bool append = (AttachmentPt & 0x80) != 0; | 650 | bool append = (AttachmentPt & 0x80) != 0; |
585 | AttachmentPt &= 0x7f; | 651 | AttachmentPt &= 0x7f; |
586 | 652 | ||
587 | return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, append); | 653 | return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, append, doc); |
588 | } | 654 | } |
589 | 655 | ||
590 | public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist) | 656 | public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist) |
@@ -649,26 +715,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
649 | if (changed && m_scene.AvatarFactory != null) | 715 | if (changed && m_scene.AvatarFactory != null) |
650 | m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); | 716 | m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); |
651 | 717 | ||
718 | so.RootPart.Shape.LastAttachPoint = (byte)so.AttachmentPoint; | ||
719 | |||
652 | sp.RemoveAttachment(so); | 720 | sp.RemoveAttachment(so); |
653 | so.FromItemID = UUID.Zero; | 721 | so.FromItemID = UUID.Zero; |
654 | 722 | ||
723 | so.AttachedAvatar = UUID.Zero; | ||
724 | so.ClearPartAttachmentData(); | ||
725 | |||
655 | SceneObjectPart rootPart = so.RootPart; | 726 | SceneObjectPart rootPart = so.RootPart; |
727 | |||
728 | rootPart.SetParentLocalId(0); | ||
656 | so.AbsolutePosition = absolutePos; | 729 | so.AbsolutePosition = absolutePos; |
657 | if (absoluteRot != Quaternion.Identity) | 730 | if (absoluteRot != Quaternion.Identity) |
658 | { | 731 | { |
659 | so.UpdateGroupRotationR(absoluteRot); | 732 | so.UpdateGroupRotationR(absoluteRot); |
660 | } | 733 | } |
661 | so.AttachedAvatar = UUID.Zero; | 734 | |
662 | rootPart.SetParentLocalId(0); | 735 | rootPart.RemFlag(PrimFlags.TemporaryOnRez); |
663 | so.ClearPartAttachmentData(); | 736 | |
664 | rootPart.ApplyPhysics(rootPart.GetEffectiveObjectFlags(), rootPart.VolumeDetectActive); | 737 | // not physical, not temporary, phaton, not volume detector |
738 | // so.UpdatePrimFlags(rootPart.LocalId,false,false,true,rootPart.VolumeDetectActive); | ||
739 | |||
740 | // restore full physical state instead | ||
741 | so.ApplyPhysics(); | ||
742 | |||
665 | so.HasGroupChanged = true; | 743 | so.HasGroupChanged = true; |
666 | so.RootPart.Shape.LastAttachPoint = (byte)so.AttachmentPoint; | ||
667 | rootPart.Rezzed = DateTime.Now; | 744 | rootPart.Rezzed = DateTime.Now; |
668 | rootPart.RemFlag(PrimFlags.TemporaryOnRez); | ||
669 | so.AttachToBackup(); | 745 | so.AttachToBackup(); |
670 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | 746 | m_scene.EventManager.TriggerParcelPrimCountTainted(); |
671 | rootPart.ScheduleFullUpdate(); | 747 | |
672 | rootPart.ClearUndoState(); | 748 | rootPart.ClearUndoState(); |
673 | 749 | ||
674 | List<UUID> uuids = new List<UUID>(); | 750 | List<UUID> uuids = new List<UUID>(); |
@@ -678,6 +754,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
678 | } | 754 | } |
679 | 755 | ||
680 | m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); | 756 | m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); |
757 | |||
758 | // Attach (NULL) stops scripts. We don't want that. Resume them. | ||
759 | so.ResumeScripts(); | ||
760 | so.ScheduleGroupForTerseUpdate(); | ||
761 | so.RootPart.ScheduleFullUpdate(); | ||
681 | } | 762 | } |
682 | 763 | ||
683 | public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so) | 764 | public void DetachSingleAttachmentToInv(IScenePresence sp, SceneObjectGroup so) |
@@ -848,8 +929,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
848 | 929 | ||
849 | so.AttachedAvatar = sp.UUID; | 930 | so.AttachedAvatar = sp.UUID; |
850 | 931 | ||
851 | if (so.RootPart.PhysActor != null) | 932 | foreach (SceneObjectPart part in so.Parts) |
852 | so.RootPart.RemoveFromPhysics(); | 933 | { |
934 | // if (part.KeyframeMotion != null) | ||
935 | // part.KeyframeMotion.Suspend(); | ||
936 | |||
937 | if (part.PhysActor != null) | ||
938 | { | ||
939 | part.RemoveFromPhysics(); | ||
940 | } | ||
941 | } | ||
853 | 942 | ||
854 | so.AbsolutePosition = attachOffset; | 943 | so.AbsolutePosition = attachOffset; |
855 | so.RootPart.AttachedPos = attachOffset; | 944 | so.RootPart.AttachedPos = attachOffset; |
@@ -971,6 +1060,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
971 | // Remove the object from the scene so no more updates | 1060 | // Remove the object from the scene so no more updates |
972 | // are sent. Doing this before the below changes will ensure | 1061 | // are sent. Doing this before the below changes will ensure |
973 | // updates can't cause "HUD artefacts" | 1062 | // updates can't cause "HUD artefacts" |
1063 | |||
974 | m_scene.DeleteSceneObject(so, false, false); | 1064 | m_scene.DeleteSceneObject(so, false, false); |
975 | 1065 | ||
976 | // Prepare sog for storage | 1066 | // Prepare sog for storage |
@@ -992,7 +1082,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
992 | } | 1082 | } |
993 | 1083 | ||
994 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 1084 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
995 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, bool append) | 1085 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, bool append, XmlDocument doc) |
996 | { | 1086 | { |
997 | if (m_invAccessModule == null) | 1087 | if (m_invAccessModule == null) |
998 | return null; | 1088 | return null; |
@@ -1043,7 +1133,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1043 | // This will throw if the attachment fails | 1133 | // This will throw if the attachment fails |
1044 | try | 1134 | try |
1045 | { | 1135 | { |
1046 | AttachObjectInternal(sp, objatt, attachmentPt, false, true, true, append); | 1136 | if (doc != null) |
1137 | { | ||
1138 | objatt.LoadScriptState(doc); | ||
1139 | objatt.ResetOwnerChangeFlag(); | ||
1140 | } | ||
1141 | |||
1142 | AttachObjectInternal(sp, objatt, attachmentPt, false, true, true, true, append); | ||
1047 | } | 1143 | } |
1048 | catch (Exception e) | 1144 | catch (Exception e) |
1049 | { | 1145 | { |
@@ -1197,7 +1293,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1197 | AttachmentPt &= 0x7f; | 1293 | AttachmentPt &= 0x7f; |
1198 | 1294 | ||
1199 | // Calls attach with a Zero position | 1295 | // Calls attach with a Zero position |
1200 | if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true, append)) | 1296 | if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, false, true, append)) |
1201 | { | 1297 | { |
1202 | if (DebugLevel > 0) | 1298 | if (DebugLevel > 0) |
1203 | m_log.Debug( | 1299 | m_log.Debug( |
@@ -1205,7 +1301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
1205 | + ", AttachmentPoint: " + AttachmentPt); | 1301 | + ", AttachmentPoint: " + AttachmentPt); |
1206 | 1302 | ||
1207 | // Save avatar attachment information | 1303 | // Save avatar attachment information |
1208 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); | 1304 | m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); |
1209 | } | 1305 | } |
1210 | } | 1306 | } |
1211 | catch (Exception e) | 1307 | catch (Exception e) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 0ac3add..34b38b9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -200,7 +200,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
200 | Assert.That(so.Backup, Is.True); | 200 | Assert.That(so.Backup, Is.True); |
201 | 201 | ||
202 | m_numberOfAttachEventsFired = 0; | 202 | m_numberOfAttachEventsFired = 0; |
203 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false); | 203 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false, false); |
204 | 204 | ||
205 | // Check status on scene presence | 205 | // Check status on scene presence |
206 | Assert.That(sp.HasAttachments(), Is.True); | 206 | Assert.That(sp.HasAttachments(), Is.True); |
@@ -248,7 +248,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
248 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "att1", sp.UUID); | 248 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "att1", sp.UUID); |
249 | 249 | ||
250 | m_numberOfAttachEventsFired = 0; | 250 | m_numberOfAttachEventsFired = 0; |
251 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Default, false, true, false); | 251 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Default, false, true, false, false); |
252 | 252 | ||
253 | // Check status on scene presence | 253 | // Check status on scene presence |
254 | Assert.That(sp.HasAttachments(), Is.True); | 254 | Assert.That(sp.HasAttachments(), Is.True); |
@@ -281,7 +281,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
281 | 281 | ||
282 | // Test wearing a different attachment from the ground. | 282 | // Test wearing a different attachment from the ground. |
283 | { | 283 | { |
284 | scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, true, false); | 284 | scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, true, false, false); |
285 | 285 | ||
286 | // Check status on scene presence | 286 | // Check status on scene presence |
287 | Assert.That(sp.HasAttachments(), Is.True); | 287 | Assert.That(sp.HasAttachments(), Is.True); |
@@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
314 | 314 | ||
315 | // Test rewearing an already worn attachment from ground. Nothing should happen. | 315 | // Test rewearing an already worn attachment from ground. Nothing should happen. |
316 | { | 316 | { |
317 | scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, true, false); | 317 | scene.AttachmentsModule.AttachObject(sp, so2, (uint)AttachmentPoint.Default, false, true, false, false); |
318 | 318 | ||
319 | // Check status on scene presence | 319 | // Check status on scene presence |
320 | Assert.That(sp.HasAttachments(), Is.True); | 320 | Assert.That(sp.HasAttachments(), Is.True); |
@@ -372,7 +372,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
372 | sp2.AbsolutePosition = new Vector3(0, 0, 0); | 372 | sp2.AbsolutePosition = new Vector3(0, 0, 0); |
373 | sp2.HandleAgentRequestSit(sp2.ControllingClient, sp2.UUID, so.UUID, Vector3.Zero); | 373 | sp2.HandleAgentRequestSit(sp2.ControllingClient, sp2.UUID, so.UUID, Vector3.Zero); |
374 | 374 | ||
375 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false); | 375 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false, false); |
376 | 376 | ||
377 | Assert.That(sp.HasAttachments(), Is.False); | 377 | Assert.That(sp.HasAttachments(), Is.False); |
378 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); | 378 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); |
@@ -670,7 +670,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
670 | scene.EventManager.OnChatFromWorld += OnChatFromWorld; | 670 | scene.EventManager.OnChatFromWorld += OnChatFromWorld; |
671 | 671 | ||
672 | SceneObjectGroup rezzedSo | 672 | SceneObjectGroup rezzedSo |
673 | = scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest); | 673 | = (SceneObjectGroup)(scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest)); |
674 | 674 | ||
675 | // Wait for chat to signal rezzed script has been started. | 675 | // Wait for chat to signal rezzed script has been started. |
676 | m_chatEvent.WaitOne(60000); | 676 | m_chatEvent.WaitOne(60000); |
@@ -689,7 +689,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
689 | Assert.That(scriptStateNodes.Count, Is.EqualTo(1)); | 689 | Assert.That(scriptStateNodes.Count, Is.EqualTo(1)); |
690 | 690 | ||
691 | // Re-rez the attachment to check script running state | 691 | // Re-rez the attachment to check script running state |
692 | SceneObjectGroup reRezzedSo = scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest); | 692 | SceneObjectGroup reRezzedSo = (SceneObjectGroup)(scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest)); |
693 | 693 | ||
694 | // Wait for chat to signal rezzed script has been started. | 694 | // Wait for chat to signal rezzed script has been started. |
695 | m_chatEvent.WaitOne(60000); | 695 | m_chatEvent.WaitOne(60000); |