コード例 #1
0
        public void MakeChildAgent(IScenePresence sp, GridRegion finalDestination, bool isCrossing)
        {
            if (sp == null)
            {
                return;
            }

            sp.SetAgentLeaving(finalDestination);

            // Well, this is it. The agent is over there.
            KillEntity(sp.Scene, sp);

            //Make it a child agent for now... the grid will kill us later if we need to close
            sp.MakeChildAgent(finalDestination);

            if (isCrossing)
            {
                sp.SuccessfulCrossingTransit(finalDestination);
            }
        }
コード例 #2
0
        public void MakeChildAgent(IScenePresence sp, GridRegion finalDestination, bool isCrossing)
        {
            if (sp == null)
            {
                return;
            }

            sp.SetAgentLeaving(finalDestination);

            // Kill the groups here, otherwise they will become ghost attachments
            //  and stay in the sim, they'll get re-added below into the new sim
            // KillAttachments(sp);

            // Well, this is it. The agent is over there.
            KillEntity(sp.Scene, sp);

            // Make it a child agent for now... the grid will kill us later if we need to close
            sp.MakeChildAgent(finalDestination);

            if (isCrossing)
            {
                sp.SuccessfulCrossingTransit(finalDestination);
            }
        }
コード例 #3
0
        public void MakeChildAgent(IScenePresence sp, GridRegion finalDestination, bool isCrossing)
        {
            if (sp == null)
                return;

            sp.SetAgentLeaving(finalDestination);

            //Kill the groups here, otherwise they will become ghost attachments
            //  and stay in the sim, they'll get readded below into the new sim
            //KillAttachments(sp);

            // Well, this is it. The agent is over there.
            KillEntity(sp.Scene, sp);

            //Make it a child agent for now... the grid will kill us later if we need to close
            sp.MakeChildAgent(finalDestination);

            if (isCrossing)
                sp.SuccessfulCrossingTransit(finalDestination);
        }
コード例 #4
0
        public virtual void InternalCross(IScenePresence agent, Vector3 attemptedPos, bool isFlying, GridRegion crossingRegion)
        {
            if(agent.PhysicsActor != null)
                agent.PhysicsActor.IsPhysical = false;
            
            MainConsole.Instance.DebugFormat("[EntityTransferModule]: Crossing agent {0} to region {1}", agent.Name, crossingRegion.RegionName);

            try
            {
                agent.SetAgentLeaving(crossingRegion);

                AgentData cAgent = new AgentData();
                agent.CopyTo(cAgent);
                cAgent.Position = attemptedPos;
                if (isFlying)
                    cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;

                AgentCircuitData agentCircuit = BuildCircuitDataForPresence(agent, attemptedPos);
                agentCircuit.teleportFlags = (uint)TeleportFlags.ViaRegionID;

                IEventQueueService eq = agent.Scene.RequestModuleInterface<IEventQueueService>();
                if (eq != null)
                {
                    //This does UpdateAgent and closing of child agents
                    //  messages if they need to be called
                    ISyncMessagePosterService syncPoster =
                        agent.Scene.RequestModuleInterface<ISyncMessagePosterService>();
                    if (syncPoster != null)
                    {
                        syncPoster.Get(SyncMessageHelper.CrossAgent(crossingRegion, attemptedPos,
                            agent.Velocity, agentCircuit, cAgent,
                            agent.Scene.RegionInfo.RegionHandle),
                            agent.UUID, agent.Scene.RegionInfo.RegionHandle,
                            (map) =>
                            {
                                if (map == null || !map["success"].AsBoolean())
                                {
                                    //Tell modules that we have failed
                                    agent.AgentFailedToLeave();
                                    if (map != null)
                                    {
                                        if (map.ContainsKey("Note") && !map["Note"].AsBoolean())
                                            return;
                                        agent.ControllingClient.SendTeleportFailed(map["Reason"].AsString());
                                    }
                                    else
                                        agent.ControllingClient.SendTeleportFailed("TP Failed");
                                    if (agent.PhysicsActor != null)
                                        agent.PhysicsActor.IsPhysical = true; //Fix the setting that we set earlier
                                    // In any case
                                    agent.FailedCrossingTransit(crossingRegion);
                                    return;
                                }
                                //We're killing the animator and the physics actor, so we don't need to worry about agent.PhysicsActor.IsPhysical
                                agent.MakeChildAgent(crossingRegion);
                                //Revolution- We already were in this region... we don't need updates about the avatars we already know about, right?
                                // OLD: now we have a child agent in this region. Request and send all interesting data about (root) agents in the sim
                                //agent.SendOtherAgentsAvatarDataToMe();
                                //agent.SendOtherAgentsAppearanceToMe();

                                //Kill the groups here, otherwise they will become ghost attachments 
                                //  and stay in the sim, they'll get readded below into the new sim
                                //KillAttachments(agent);
                                // In any case
                                agent.SuccessfulCrossingTransit(crossingRegion);
                            });
                    }
                }

            }
            catch(Exception ex)
            {
                MainConsole.Instance.Warn("[EntityTransferModule]: Exception in crossing: " + ex);
            }
        }
コード例 #5
0
        /// <summary>
        /// This Closes child agents on neighboring regions
        /// Calls an asynchronous method to do so..  so it doesn't lag the sim.
        /// </summary>
        protected IScenePresence CrossAgentToNewRegionAsync(IScenePresence agent, Vector3 pos,
            GridRegion crossingRegion, bool isFlying, bool positionIsAlreadyFixed)
        {
            m_log.DebugFormat("[EntityTransferModule]: Crossing agent {0} to region {1}", agent.Name, crossingRegion.RegionName);

            IScene m_scene = agent.Scene;

            try
            {
                if (crossingRegion != null)
                {
                    //Make sure that all attachments are ready for the teleport
                    IAttachmentsModule attModule = agent.Scene.RequestModuleInterface<IAttachmentsModule>();
                    if (attModule != null)
                        attModule.ValidateAttachments(agent.UUID);

                    if(!positionIsAlreadyFixed)
                    {
                        int xOffset = crossingRegion.RegionLocX - m_scene.RegionInfo.RegionLocX;
                        int yOffset = crossingRegion.RegionLocY - m_scene.RegionInfo.RegionLocY;

                        if(xOffset < 0)
                            pos.X += m_scene.RegionInfo.RegionSizeX;
                        else if(xOffset > 0)
                            pos.X -= m_scene.RegionInfo.RegionSizeX;

                        if(yOffset < 0)
                            pos.Y += m_scene.RegionInfo.RegionSizeY;
                        else if(yOffset > 0)
                            pos.Y -= m_scene.RegionInfo.RegionSizeY;

                        //Make sure that they are within bounds (velocity can push it out of bounds)
                        if(pos.X < 0)
                            pos.X = 1;
                        if(pos.Y < 0)
                            pos.Y = 1;

                        if(pos.X > crossingRegion.RegionSizeX)
                            pos.X = crossingRegion.RegionSizeX - 1;
                        if(pos.Y > crossingRegion.RegionSizeY)
                            pos.Y = crossingRegion.RegionSizeY - 1;
                    }

                    AgentData cAgent = new AgentData();
                    agent.CopyTo(cAgent);
                    cAgent.Position = pos;
                    if (isFlying)
                        cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;

                    AgentCircuitData agentCircuit = agent.ControllingClient.RequestClientInfo();
                    agentCircuit.startpos = pos;
                    agentCircuit.child = false;
                    agentCircuit.teleportFlags = (uint)TeleportFlags.ViaRegionID;
                    IAvatarAppearanceModule appearance = agent.RequestModuleInterface<IAvatarAppearanceModule>();
                    if (appearance != null)
                        agentCircuit.Appearance = appearance.Appearance;

                    IEventQueueService eq = agent.Scene.RequestModuleInterface<IEventQueueService>();
                    if (eq != null)
                    {
                        //This does UpdateAgent and closing of child agents
                        //  messages if they need to be called
                        ISyncMessagePosterService syncPoster = agent.Scene.RequestModuleInterface<ISyncMessagePosterService>();
                        if (syncPoster != null)
                        {
                            OSDMap map = syncPoster.Get(SyncMessageHelper.CrossAgent(crossingRegion, pos,
                                agent.Velocity, agentCircuit, cAgent, agent.Scene.RegionInfo.RegionHandle),
                                agent.UUID, agent.Scene.RegionInfo.RegionHandle);
                            bool result = false;
                            if (map != null)
                                result = map["Success"].AsBoolean();
                            if (!result)
                            {
                                //Fix user's attachments
                                attModule.RezAttachments (agent);
                                if (map != null)
                                {
                                    if (map.ContainsKey("Note") && !map["Note"].AsBoolean ())
                                        return agent;
                                    agent.ControllingClient.SendTeleportFailed (map["Reason"].AsString ());
                                }
                                else
                                    agent.ControllingClient.SendTeleportFailed ("TP Failed");
                                if (agent.PhysicsActor != null)
                                    agent.PhysicsActor.IsPhysical = true; //Fix the setting that we set earlier
                                // In any case
                                agent.FailedCrossingTransit(crossingRegion);
                                return agent;
                            }
                        }
                    }
                    //We're killing the animator and the physics actor, so we don't need to worry about agent.PhysicsActor.IsPhysical
                    agent.MakeChildAgent(crossingRegion);

                    //Revolution- We already were in this region... we don't need updates about the avatars we already know about, right?
                    // OLD: now we have a child agent in this region. Request and send all interesting data about (root) agents in the sim
                    //agent.SendOtherAgentsAvatarDataToMe();
                    //agent.SendOtherAgentsAppearanceToMe();

                    //Kill the groups here, otherwise they will become ghost attachments 
                    //  and stay in the sim, they'll get readded below into the new sim
                    KillAttachments(agent);
                }
            }
            catch(Exception ex)
            {
                m_log.Warn("[EntityTransferModule]: Exception in crossing: " + ex.ToString());
            }
            // In any case
            agent.SuccessfulCrossingTransit(crossingRegion);
            return agent;
        }
コード例 #6
0
        public void MakeChildAgent(IScenePresence sp, GridRegion finalDestination, bool isCrossing)
        {
            if (sp == null)
                return;

            sp.SetAgentLeaving(finalDestination);

            // Well, this is it. The agent is over there.
            KillEntity(sp.Scene, sp);

            //Make it a child agent for now... the grid will kill us later if we need to close
            sp.MakeChildAgent(finalDestination);

            if (isCrossing)
                sp.SuccessfulCrossingTransit(finalDestination);
        }