/// <summary>
        /// This turns a root agent into a child agent
        /// when an agent departs this region for a neighbor, this gets called.
        ///
        /// It doesn't get called for a teleport.  Reason being, an agent that
        /// teleports out may not end up anywhere near this region
        /// </summary>
        public void MakeChildAgent(GridRegion destindation)
        {
            SuccessfulTransit();
            // It looks like m_animator is set to null somewhere, and MakeChild
            // is called after that. Probably in aborted teleports.
            if (m_animator == null)
                m_animator = new Animator(this);
            else
                Animator.ResetAnimations();

            MainConsole.Instance.DebugFormat(
                 "[SCENEPRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}",
                 Name, UUID, m_scene.RegionInfo.RegionName);

            IsChildAgent = true;
            RemoveFromPhysicalScene();
            m_sceneViewer.Reset();

            SendScriptEventToAllAttachments(Changed.TELEPORT);
            m_scene.EventManager.TriggerOnMakeChildAgent(this, destindation);

            Reset();
        }
        public void Close()
        {
            m_sceneViewer.Close();

            RemoveFromPhysicalScene();
            if (m_animator == null)
                return;
            m_animator.Close();
            m_animator = null;
        }
        public AsyncScenePresence(IClientAPI client, IScene world)
            : this()
        {
            m_controllingClient = client;
            m_firstname = m_controllingClient.FirstName;
            m_lastname = m_controllingClient.LastName;
            m_name = m_controllingClient.Name;
            m_scene = world;
            m_uuid = client.AgentId;
            m_localId = m_scene.SceneGraph.AllocateLocalId();

            CreateSceneViewer();

            m_animator = new Animator(this);

            UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);

            if (account != null)
                m_userLevel = account.UserLevel;

            AbsolutePosition = posLastSignificantMove = m_CameraCenter = m_controllingClient.StartPos;

            // This won't send anything, as we are still a child here...
            //Animator.TrySetMovementAnimation("STAND"); 

            // we created a new ScenePresence (a new child agent) in a fresh region.
            // Request info about all the (root) agents in this region
            // Note: This won't send data *to* other clients in that region (children don't send)
            //SendInitialFullUpdateToAllClients();
            //SendOtherAgentsAvatarDataToMe();
            //Comment this out for now, just to see what happens
            //SendOtherAgentsAppearanceToMe();

            RegisterToEvents();
            SetDirectionVectors();
        }
示例#4
0
        /// <summary>
        /// This turns a root agent into a child agent
        /// when an agent departs this region for a neighbor, this gets called.
        ///
        /// It doesn't get called for a teleport.  Reason being, an agent that
        /// teleports out may not end up anywhere near this region
        /// </summary>
        public virtual void MakeChildAgent (GridRegion destindation)
        {
            SuccessfulTransit ();
            // It looks like m_animator is set to null somewhere, and MakeChild
            // is called after that. Probably in aborted teleports.
            if (m_animator == null)
                m_animator = new Animator(this);
            else
                Animator.ResetAnimations();

            m_log.DebugFormat(
                 "[SCENEPRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}",
                 Name, UUID, m_scene.RegionInfo.RegionName);

            IsChildAgent = true;
            RemoveFromPhysicalScene ();
            m_sceneViewer.Reset ();

            IAttachmentsModule attMod = Scene.RequestModuleInterface<IAttachmentsModule>();
            if (attMod != null)
                attMod.SendScriptEventToAttachments(UUID, "changed", new Object[] { Changed.TELEPORT });
            m_scene.EventManager.TriggerOnMakeChildAgent(this, destindation);

            Reset();
        }