Exemple #1
0
        public void T030_TestAddAttachments()
        {
            TestHelper.InMethod();

            ScenePresence presence = scene.GetScenePresence(agent1);

            presence.AddAttachment(sog1);
            presence.AddAttachment(sog2);
            presence.AddAttachment(sog3);

            Assert.That(presence.HasAttachments(), Is.True);
            Assert.That(presence.ValidateAttachments(), Is.True);
        }
        /// <summary>
        /// Attach this scene object to the given avatar.
        /// </summary>
        ///
        /// This isn't publicly available since attachments should always perform the corresponding inventory
        /// operation (to show the attach in user inventory and update the asset with positional information).
        ///
        /// <param name="sp"></param>
        /// <param name="so"></param>
        /// <param name="attachmentpoint"></param>
        /// <param name="AttachOffset"></param>
        /// <param name="silent"></param>
        protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 AttachOffset, bool silent)
        {
            // don't attach attachments to child agents
            if (avatar.IsChildAgent)
            {
                return;
            }

//                m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name);

            so.DetachFromBackup();

            // Remove from database and parcel prim count
            m_scene.DeleteFromStorage(so.UUID);
            m_scene.EventManager.TriggerParcelPrimCountTainted();

            so.RootPart.AttachedAvatar = avatar.UUID;

            //Anakin Lohner bug #3839
            SceneObjectPart[] parts = so.Parts;
            for (int i = 0; i < parts.Length; i++)
            {
                parts[i].AttachedAvatar = avatar.UUID;
            }

            if (so.RootPart.PhysActor != null)
            {
                m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
                so.RootPart.PhysActor = null;
            }

            so.AbsolutePosition      = AttachOffset;
            so.RootPart.AttachedPos  = AttachOffset;
            so.RootPart.IsAttachment = true;

            so.RootPart.SetParentLocalId(avatar.LocalId);
            so.SetAttachmentPoint(Convert.ToByte(attachmentpoint));

            avatar.AddAttachment(so);

            if (!silent)
            {
                // Killing it here will cause the client to deselect it
                // It then reappears on the avatar, deselected
                // through the full update below
                //
                if (so.IsSelected)
                {
                    m_scene.SendKillObject(so.RootPart.LocalId);
                }

                so.IsSelected = false; // fudge....
                so.ScheduleGroupForFullUpdate();
            }

            // In case it is later dropped again, don't let
            // it get cleaned up
            so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
            so.HasGroupChanged = false;
        }
Exemple #3
0
        // I'm commenting this test because scene setup NEEDS InventoryService to
        // be non-null
        //[Test]
        public void T032_CrossAttachments()
        {
            TestHelper.InMethod();

            ScenePresence presence  = scene.GetScenePresence(agent1);
            ScenePresence presence2 = scene2.GetScenePresence(agent1);

            presence2.AddAttachment(sog1);
            presence2.AddAttachment(sog2);

            ISharedRegionModule serialiser = new SerialiserModule();

            SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser);
            SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser);

            Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");

            //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
            Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
            Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
        }