Beispiel #1
0
        public bool UpdateAgent(GridRegion destination, AgentData cAgentData)
        {
            if (destination == null)
            {
                return(false);
            }

            bool retVal = false;

            foreach (Scene s in m_sceneList)
            {
                IEntityTransferModule transferModule = s.RequestModuleInterface <IEntityTransferModule> ();
                if (transferModule != null)
                {
                    if (retVal)
                    {
                        transferModule.IncomingChildAgentDataUpdate(s, cAgentData);
                    }
                    else
                    {
                        retVal = transferModule.IncomingChildAgentDataUpdate(s, cAgentData);
                    }
                }
            }

            //            m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle);
            return(retVal);
        }
Beispiel #2
0
        public void OnTeleportLureRequest(UUID lureID, uint teleportFlags, IClientAPI client)
        {
            if (!(client.Scene is Scene))
            {
                return;
            }
            Scene scene = (Scene)(client.Scene);

            ulong handle = 0;
            uint  x      = 128;
            uint  y      = 128;
            uint  z      = 70;

            Util.ParseFakeParcelID(lureID, out handle, out x, out y, out z);

            Vector3 position = new Vector3();

            position.X = (float)x;
            position.Y = (float)y;
            position.Z = (float)z;
            IEntityTransferModule entityTransfer = scene.RequestModuleInterface <IEntityTransferModule>();

            if (entityTransfer != null)
            {
                entityTransfer.RequestTeleportLocation(client, handle, position,
                                                       Vector3.Zero, teleportFlags);
            }
        }
Beispiel #3
0
        /**
         * Agent-related communications
         */

        public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, AgentData data, out string reason)
        {
            if (destination == null)
            {
                reason = "Given destination was null";
                m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: CreateAgent was given a null destination");
                return(false);
            }

            foreach (Scene s in m_sceneList)
            {
                if (s.RegionInfo.RegionID == destination.RegionID)
                {
                    //m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
                    if (data != null)
                    {
                        UpdateAgent(destination, data);
                    }
                    IEntityTransferModule transferModule = s.RequestModuleInterface <IEntityTransferModule> ();
                    if (transferModule != null)
                    {
                        return(transferModule.NewUserConnection(s, aCircuit, teleportFlags, out reason));
                    }
                }
            }

            m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Did not find region {0} for CreateAgent", destination.RegionName);
            OSDMap map = new OSDMap();

            map["Reason"]  = "Did not find region " + destination.RegionName;
            map["Success"] = false;
            reason         = OSDParser.SerializeJsonString(map);
            return(false);
        }
Beispiel #4
0
        public bool RetrieveAgent(GridRegion destination, UUID id, bool agentIsLeaving, out AgentData agent,
                                  out AgentCircuitData circuitData)
        {
            agent       = null;
            circuitData = null;

            if (destination == null)
            {
                return(false);
            }

            foreach (IScene s in m_sceneList)
            {
                if (s.RegionInfo.RegionID == destination.RegionID)
                {
                    //MainConsole.Instance.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
                    IEntityTransferModule transferModule = s.RequestModuleInterface <IEntityTransferModule>();
                    if (transferModule != null)
                    {
                        return(transferModule.IncomingRetrieveRootAgent(s, id, agentIsLeaving, out agent,
                                                                        out circuitData));
                    }
                }
            }
            //MainConsole.Instance.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
            return(false);
        }
        /**
         * Agent-related communications
         */

        public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out CreateAgentResponse response)
        {
            response = new CreateAgentResponse();
            IScene Scene = destination == null ? null : GetScene(destination.RegionID);

            if (destination == null || Scene == null)
            {
                response.Reason  = "Given destination was null";
                response.Success = false;
                return(false);
            }

            if (Scene.RegionInfo.RegionID != destination.RegionID)
            {
                response.Reason  = "Did not find region " + destination.RegionName;
                response.Success = false;
                return(false);
            }
            IEntityTransferModule transferModule = Scene.RequestModuleInterface <IEntityTransferModule> ();

            if (transferModule != null)
            {
                return(transferModule.NewUserConnection(Scene, aCircuit, teleportFlags, out response));
            }

            response.Reason  = "Did not find region " + destination.RegionName;
            response.Success = false;
            return(false);
        }
Beispiel #6
0
        public bool UpdateAgent(GridRegion destination, AgentData cAgentData)
        {
            if (destination == null || m_sceneList.Count == 0 || cAgentData == null)
            {
                return(false);
            }

            bool retVal = false;
            IEntityTransferModule transferModule = m_sceneList[0].RequestModuleInterface <IEntityTransferModule>();

            if (transferModule != null)
            {
#if (!ISWIN)
                foreach (IScene s in m_sceneList)
                {
                    if (destination.RegionID == s.RegionInfo.RegionID)
                    {
                        retVal = transferModule.IncomingChildAgentDataUpdate(s, cAgentData);
                    }
                }
#else
                foreach (IScene s in m_sceneList.Where(s => destination.RegionID == s.RegionInfo.RegionID))
                {
                    retVal = transferModule.IncomingChildAgentDataUpdate(s, cAgentData);
                }
#endif
            }

            //            MainConsole.Instance.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle);
            return(retVal);
        }
Beispiel #7
0
        public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData)
        {
            if (destination == null)
            {
                return(false);
            }

            bool retVal = false;

            foreach (Scene s in m_sceneList)
            {
                //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
                IEntityTransferModule transferModule = s.RequestModuleInterface <IEntityTransferModule> ();
                if (transferModule != null)
                {
                    if (retVal)
                    {
                        transferModule.IncomingChildAgentDataUpdate(s, cAgentData);
                    }
                    else
                    {
                        retVal = transferModule.IncomingChildAgentDataUpdate(s, cAgentData);
                    }
                }
            }
            //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
            return(retVal);
        }
Beispiel #8
0
        public void RemoveAvatar(UUID avatarID, IScene scene, UUID userAttempting)
        {
            IEntity sp = scene.GetScenePresence(avatarID);

            if (sp == null)
            {
                sp = scene.GetSceneObjectPart(avatarID);
                if (sp == null)
                {
                    return;
                }
                sp = ((ISceneChildEntity)sp).ParentEntity;
            }
            if (!CheckPermission(sp, userAttempting))
            {
                return;
            }

            RemoveAllTagsFromBot(avatarID, userAttempting);
            if (!m_bots.Remove(avatarID))
            {
                return;
            }
            //Kill the agent
            IEntityTransferModule module = scene.RequestModuleInterface <IEntityTransferModule>();

            module.IncomingCloseAgent(scene, avatarID);
        }
            public void KillAvatar(IScenePresence killingAvatar, string killingAvatarMessage, string deadAvatarMessage,
                                   bool TeleportAgent, bool showAgentMessages)
            {
                try {
                    if (showAgentMessages)
                    {
                        if (deadAvatarMessage != "")
                        {
                            m_SP.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true);
                        }
                        //Send it as a blue box at the bottom of the screen rather than as a full popup
                        if (killingAvatar != null && killingAvatarMessage != "")
                        {
                            killingAvatar.ControllingClient.SendAlertMessage(killingAvatarMessage);
                        }
                    }
                } catch (InvalidOperationException) {
                }

                Health = m_combatModule.MaximumHealth;
                if (TeleportAgent)
                {
                    if (m_combatModule.m_shouldRespawn)
                    {
                        if (m_combatModule.m_SecondsBeforeRespawn != 0)
                        {
                            m_SP.AllowMovement = false;
                            HasLeftCombat      = true;
                            respawnTimer       = new Timer {
                                Interval = m_combatModule.m_SecondsBeforeRespawn * 1000, AutoReset = false
                            };
                            //Use this to re-enable movement and combat
                            //Only once
                            respawnTimer.Elapsed += respawn_Elapsed;
                            respawnTimer.Start();
                        }
                        m_SP.Teleport(m_combatModule.m_RespawnPosition);
                    }
                    else
                    {
                        IEntityTransferModule transferModule =
                            m_SP.Scene.RequestModuleInterface <IEntityTransferModule> ();
                        if (transferModule != null)
                        {
                            if (!transferModule.TeleportHome(m_SP.UUID, m_SP.ControllingClient))
                            {
                                if (m_SP.PhysicsActor != null)
                                {
                                    m_SP.PhysicsActor.Flying = true;
                                }
                                m_SP.Teleport(new Vector3(m_SP.Scene.RegionInfo.RegionSizeX / 2,
                                                          m_SP.Scene.RegionInfo.RegionSizeY / 2, 128));
                            }
                        }
                    }
                }

                m_SP.Scene.WhiteCoreEventManager.FireGenericEventHandler("OnAvatarDeath", m_SP);
            }
Beispiel #10
0
        /**
         * Agent-related communications
         */

        public bool CreateAgent(GridRegion destination, ref AgentCircuitData aCircuit, uint teleportFlags,
                                AgentData data, out int requestedUDPPort, out string reason)
        {
            requestedUDPPort = 0;
            if (destination.ExternalEndPoint != null)
            {
                requestedUDPPort = destination.ExternalEndPoint.Port;
            }
            if (destination == null)
            {
                reason = "Given destination was null";
                MainConsole.Instance.DebugFormat("[LOCAL SIMULATION CONNECTOR]: CreateAgent was given a null destination");
                return(false);
            }

#if (!ISWIN)
            foreach (IScene s in m_sceneList)
            {
                if (s.RegionInfo.RegionID == destination.RegionID)
                {
                    //MainConsole.Instance.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
                    if (data != null)
                    {
                        UpdateAgent(destination, data);
                    }
                    IEntityTransferModule transferModule = s.RequestModuleInterface <IEntityTransferModule>();
                    if (transferModule != null)
                    {
                        return(transferModule.NewUserConnection(s, aCircuit, teleportFlags, out requestedUDPPort, out reason));
                    }
                }
            }
#else
            foreach (IScene s in m_sceneList.Where(s => s.RegionInfo.RegionID == destination.RegionID))
            {
                //MainConsole.Instance.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
                if (data != null)
                {
                    UpdateAgent(destination, data);
                }
                IEntityTransferModule transferModule = s.RequestModuleInterface <IEntityTransferModule>();
                if (transferModule != null)
                {
                    return(transferModule.NewUserConnection(s, aCircuit, teleportFlags, out requestedUDPPort,
                                                            out reason));
                }
            }
#endif

            MainConsole.Instance.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Did not find region {0} for CreateAgent",
                                             destination.RegionName);
            OSDMap map = new OSDMap();
            map["Reason"]  = "Did not find region " + destination.RegionName;
            map["Success"] = false;
            reason         = OSDParser.SerializeJsonString(map);
            return(false);
        }
        protected OSDMap OnMessageReceived(OSDMap message)
        {
            if (message.ContainsKey("Method") && message["Method"] == "GridWideMessage")
            {
                //We got a message, now display it
                string user  = message["User"].AsString();
                string value = message["Value"].AsString();

                //Get the Scene registry since IDialogModule is a region module, and isn't in the ISimulationBase registry
                ISceneManager manager = m_registry.RequestModuleInterface <ISceneManager>();
                if (manager != null)
                {
                    foreach (IScene scene in manager.Scenes)
                    {
                        IScenePresence sp = null;
                        if (scene.TryGetScenePresence(UUID.Parse(user), out sp) && !sp.IsChildAgent)
                        {
                            IDialogModule dialogModule = scene.RequestModuleInterface <IDialogModule>();
                            if (dialogModule != null)
                            {
                                //Send the message to the user now
                                dialogModule.SendAlertToUser(UUID.Parse(user), value);
                            }
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "KickUserMessage")
            {
                //We got a message, now display it
                string user  = message["User"].AsString();
                string value = message["Value"].AsString();

                //Get the Scene registry since IDialogModule is a region module, and isn't in the ISimulationBase registry
                ISceneManager manager = m_registry.RequestModuleInterface <ISceneManager>();
                if (manager != null)
                {
                    foreach (IScene scene in manager.Scenes)
                    {
                        IScenePresence sp = null;
                        if (scene.TryGetScenePresence(UUID.Parse(user), out sp))
                        {
                            sp.ControllingClient.Kick(value == "" ? "The WhiteCore Grid Manager kicked you out." : value);
                            IEntityTransferModule transferModule =
                                scene.RequestModuleInterface <IEntityTransferModule>();
                            if (transferModule != null)
                            {
                                transferModule.IncomingCloseAgent(scene, sp.UUID);
                            }
                        }
                    }
                }
            }
            return(null);
        }
        /// <summary>
        /// Tries to teleport agent to landmark.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="regionHandle"></param>
        /// <param name="position"></param>
        public override void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm)
        {
            m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}",
                              (lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position);

            if (lm.Gatekeeper == string.Empty)
            {
                base.RequestTeleportLandmark(remoteClient, lm);
                return;
            }

            GridRegion info = Scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);

            // Local region?
            if (info != null)
            {
                ((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
                                                                      Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
            }
            else
            {
                // Foreign region
                Scene scene = (Scene)(remoteClient.Scene);
                GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
                GridRegion gatekeeper            = new GridRegion();
                gatekeeper.ServerURI = lm.Gatekeeper;
                string homeURI = Scene.GetAgentHomeURI(remoteClient.AgentId);

                string     message;
                GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID), remoteClient.AgentId, homeURI, out message);

                if (finalDestination != null)
                {
                    ScenePresence         sp          = scene.GetScenePresence(remoteClient.AgentId);
                    IEntityTransferModule transferMod = scene.RequestModuleInterface <IEntityTransferModule>();

                    if (transferMod != null && sp != null)
                    {
                        if (message != null)
                        {
                            sp.ControllingClient.SendAgentAlertMessage(message, true);
                        }

                        transferMod.DoTeleport(
                            sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX,
                            (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
                    }
                }
                else
                {
                    remoteClient.SendTeleportFailed(message);
                }
            }
        }
Beispiel #13
0
        /// <summary>
        ///     This is the method that shuts down the scene.
        /// </summary>
        public void Close(bool killAgents)
        {
            if (shuttingdown)
            {
                MainConsole.Instance.WarnFormat("[Scene]: Ignoring close request because already closing {0}",
                                                RegionInfo.RegionName);
                return;
            }

            // Stop updating the scene objects and agents.
            shuttingdown = true;

            MainConsole.Instance.InfoFormat("[Scene]: Closing down region: {0}", RegionInfo.RegionName);

            SimulationDataService.Shutdown();

            if (killAgents)
            {
                // Kick all ROOT agents with the message, 'The simulator is going down'
                ForEachScenePresence(delegate(IScenePresence avatar)
                {
                    if (!avatar.IsChildAgent)
                    {
                        avatar.ControllingClient.Kick("The simulator is going down.");
                    }
                });

                // Let things process and get sent for a bit
                Thread.Sleep(1000);

                IEntityTransferModule transferModule = RequestModuleInterface <IEntityTransferModule>();
                if (transferModule != null)
                {
                    foreach (IScenePresence avatar in new List <IScenePresence>(GetScenePresences()))
                    {
                        transferModule.IncomingCloseAgent(this, avatar.UUID);
                    }
                }
            }
            m_ShouldRunHeartbeat = false; //Stop the heartbeat

            if (m_sceneGraph.PhysicsScene != null)
            {
                m_sceneGraph.PhysicsScene.Dispose();
            }

            m_sceneGraph.Close();
            foreach (IClientNetworkServer clientServer in m_clientServers)
            {
                clientServer.Stop();
                Thread.Sleep(500);
            }
        }
Beispiel #14
0
        /// <summary>
        ///     Kicks users off the region
        /// </summary>
        /// <param name="cmdparams">name of avatar to kick</param>
        private void KickUserCommand(IScene scene, string[] cmdparams)
        {
            IList agents = new List <IScenePresence>(scene.GetScenePresences());

            if (cmdparams.Length > 2 && cmdparams[2] == "all")
            {
                string alert = MainConsole.Instance.Prompt("Alert message: ", "");
                foreach (IScenePresence presence in agents)
                {
                    RegionInfo regionInfo = presence.Scene.RegionInfo;

                    MainConsole.Instance.Info(String.Format("Kicking user: {0,-16}{1,-37} in region: {2,-16}",
                                                            presence.Name, presence.UUID, regionInfo.RegionName));

                    // kick client...
                    presence.ControllingClient.Kick(alert ?? "\nThe Aurora manager kicked you out.\n");

                    // ...and close on our side
                    IEntityTransferModule transferModule =
                        presence.Scene.RequestModuleInterface <IEntityTransferModule>();
                    if (transferModule != null)
                    {
                        transferModule.IncomingCloseAgent(presence.Scene, presence.UUID);
                    }
                }
                return;
            }
            else
            {
                string username = MainConsole.Instance.Prompt("User to kick: ", "");
                string alert    = MainConsole.Instance.Prompt("Alert message: ", "");

                foreach (IScenePresence presence in agents)
                {
                    if (presence.Name.ToLower().Contains(username.ToLower()))
                    {
                        MainConsole.Instance.Info(String.Format("Kicking user: {0} in region: {1}",
                                                                presence.Name, presence.Scene.RegionInfo.RegionName));

                        // kick client...
                        presence.ControllingClient.Kick(alert ?? "\nThe Aurora manager kicked you out.\n");

                        // ...and close on our side
                        IEntityTransferModule transferModule =
                            presence.Scene.RequestModuleInterface <IEntityTransferModule>();
                        if (transferModule != null)
                        {
                            transferModule.IncomingCloseAgent(presence.Scene, presence.UUID);
                        }
                    }
                }
            }
        }
        private void Lure(IClientAPI client, uint teleportflags, GridInstantMessage im)
        {
            Scene      scene    = client.Scene as Scene;
            UUID       regionID = new UUID(im.RegionID);
            GridRegion region   = scene.GridService.GetRegionByUUID(scene.RegionInfo.ScopeID, regionID);

            if (region != null)
            {
                scene.RequestTeleportLocation(client, region.RegionHandle, im.Position + new Vector3(0.5f, 0.5f, 0f), Vector3.UnitX, teleportflags);
            }
            else // we don't have that region here. Check if it's HG
            {
                string[] parts = im.message.Split(new char[] { '@' });
                if (parts.Length > 1)
                {
                    string url = parts[parts.Length - 1]; // the last part
                    if (m_thisGridInfo.IsLocalGrid(url, true) == 0)
                    {
                        m_log.DebugFormat("[HG LURE MODULE]: Luring agent to grid {0} region {1} position {2}", url, im.RegionID, im.Position);
                        GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
                        GridRegion gatekeeper            = new GridRegion();
                        gatekeeper.ServerURI = url;
                        string homeURI = scene.GetAgentHomeURI(client.AgentId);

                        string     message;
                        GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, regionID, client.AgentId, homeURI, out message);
                        if (finalDestination != null)
                        {
                            ScenePresence         sp          = scene.GetScenePresence(client.AgentId);
                            IEntityTransferModule transferMod = scene.RequestModuleInterface <IEntityTransferModule>();

                            if (transferMod != null && sp != null)
                            {
                                if (message != null)
                                {
                                    sp.ControllingClient.SendAgentAlertMessage(message, true);
                                }

                                transferMod.DoTeleport(
                                    sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 0f),
                                    Vector3.UnitX, teleportflags);
                            }
                        }
                        else
                        {
                            m_log.InfoFormat("[HG LURE MODULE]: Lure failed: {0}", message);
                            client.SendAgentAlertMessage(message, true);
                        }
                    }
                }
            }
        }
Beispiel #16
0
        //private void OnMakeRootAgent(ScenePresence obj)
        //{
        //    throw new NotImplementedException();
        //}

        public void RegionLoaded(Scene scene)
        {
            if (m_Enabled)
            {
                IEntityTransferModule et = m_scene.RequestModuleInterface <IEntityTransferModule>();
                m_Helper = new SimulatorFeaturesHelper(scene, et);

                ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface <ISimulatorFeaturesModule>();
                if (featuresModule != null)
                {
                    featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
                }
            }
        }
Beispiel #17
0
        protected void BanUser(string module, string[] cmdparams)
        {
            if (cmdparams.Length < 4)
            {
                m_log.Warn("Not enough parameters!");
                return;
            }

            IScenePresence SP = ((Scene)MainConsole.Instance.ConsoleScene).SceneGraph.GetScenePresence(cmdparams[2], cmdparams[3]);

            if (SP == null)
            {
                m_log.Warn("Could not find user");
                return;
            }
            EstateSettings ES = ((Scene)MainConsole.Instance.ConsoleScene).RegionInfo.EstateSettings;

            ES.AddBan(new EstateBan()
            {
                BannedHostAddress  = "",
                BannedHostIPMask   = "",
                BannedHostNameMask = "",
                BannedUserID       = SP.UUID,
                EstateID           = ES.EstateID
            });
            ES.Save();
            string alert = null;

            if (cmdparams.Length > 4)
            {
                alert = String.Format("\n{0}\n", String.Join(" ", cmdparams, 4, cmdparams.Length - 4));
            }

            if (alert != null)
            {
                SP.ControllingClient.Kick(alert);
            }
            else
            {
                SP.ControllingClient.Kick("\nThe Aurora manager banned and kicked you out.\n");
            }

            // kick client...
            IEntityTransferModule transferModule = SP.Scene.RequestModuleInterface <IEntityTransferModule> ();

            if (transferModule != null)
            {
                transferModule.IncomingCloseAgent(SP.Scene, SP.UUID);
            }
        }
Beispiel #18
0
        private void RemoveClient(LLUDPClient udpClient)
        {
            // Remove this client from the scene
            IClientAPI client;

            if (m_scene.TryGetClient(udpClient.AgentID, out client))
            {
                client.IsLoggingOut = true;
                IEntityTransferModule transferModule = m_scene.RequestModuleInterface <IEntityTransferModule> ();
                if (transferModule != null)
                {
                    transferModule.IncomingCloseAgent(m_scene, udpClient.AgentID);
                }
            }
        }
        public bool CloseAgent(GridRegion destination, UUID agentID)
        {
            if (Scene == null || destination == null)
            {
                return(false);
            }

            IEntityTransferModule transferModule = Scene.RequestModuleInterface <IEntityTransferModule>();

            if (transferModule != null)
            {
                return(transferModule.IncomingCloseAgent(Scene, agentID));
            }
            return(false);
        }
        public bool MakeChildAgent(UUID AgentID, GridRegion destination, bool isCrossing)
        {
            if (Scene == null)
            {
                return(false);
            }

            IEntityTransferModule transferModule = Scene.RequestModuleInterface <IEntityTransferModule>();

            if (transferModule == null)
            {
                return(false);
            }
            transferModule.MakeChildAgent(Scene.GetScenePresence(AgentID), destination, isCrossing);
            return(true);
        }
Beispiel #21
0
 public bool MakeChildAgent(UUID AgentID, GridRegion destination)
 {
     foreach (IScene s in m_sceneList)
     {
         if (s.RegionInfo.RegionID == destination.RegionID)
         {
             //MainConsole.Instance.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
             IEntityTransferModule transferModule = s.RequestModuleInterface <IEntityTransferModule>();
             if (transferModule != null)
             {
                 transferModule.MakeChildAgent(s.GetScenePresence(AgentID), new GridRegion(s.RegionInfo), true);
                 return(true);
             }
         }
     }
     return(false);
 }
        public bool FailedToTeleportAgent(GridRegion destination, UUID failedRegionID, UUID agentID, string reason,
                                          bool isCrossing)
        {
            if (Scene == null)
            {
                return(false);
            }

            IEntityTransferModule transferModule = Scene.RequestModuleInterface <IEntityTransferModule>();

            if (transferModule == null)
            {
                return(false);
            }
            transferModule.FailedToTeleportAgent(destination, agentID, reason, isCrossing);
            return(true);
        }
        public bool UpdateAgent(GridRegion destination, AgentPosition agentData)
        {
            if (Scene == null || destination == null)
            {
                return(false);
            }

            //MainConsole.Instance.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
            IEntityTransferModule transferModule = Scene.RequestModuleInterface <IEntityTransferModule>();

            if (transferModule != null)
            {
                return(transferModule.IncomingChildAgentDataUpdate(Scene, agentData));
            }

            return(false);
        }
Beispiel #24
0
        public void RemoveAvatar(UUID avatarID, IScene scene)
        {
            if (!m_bots.Remove(avatarID))
            {
                return;
            }
            IScenePresence sp = scene.GetScenePresence(avatarID);

            if (sp == null)
            {
                return;
            }
            //Kill the agent
            IEntityTransferModule module = scene.RequestModuleInterface <IEntityTransferModule> ();

            module.IncomingCloseAgent(scene, avatarID);
        }
        /**
         * Object-related communications
         */

        public bool CreateObject(GridRegion destination, ISceneEntity sog)
        {
            if (Scene == null || destination == null)
            {
                return(false);
            }

            //MainConsole.Instance.Debug("[LOCAL COMMS]: Found region to SendCreateObject");
            IEntityTransferModule AgentTransferModule = Scene.RequestModuleInterface <IEntityTransferModule>();

            if (AgentTransferModule != null)
            {
                return(AgentTransferModule.IncomingCreateObject(Scene.RegionInfo.RegionID, sog));
            }

            return(false);
        }
        public void RemoveAvatar(UUID avatarID, IScene scene, UUID userAttempting)
        {
            IEntity sp = scene.GetScenePresence(avatarID);

            if (sp == null)
            {
                sp = scene.GetSceneObjectPart(avatarID);
                if (sp == null)
                {
                    return;
                }
                sp = ((ISceneChildEntity)sp).ParentEntity;
            }
            if (!CheckPermission(sp, userAttempting))
            {
                return;
            }

            RemoveAllTagsFromBot(avatarID, userAttempting);

            if (!m_bots.Remove(avatarID))
            {
                return;
            }

            //Kill the agent
            IEntityTransferModule module = scene.RequestModuleInterface <IEntityTransferModule>();

            module.IncomingCloseAgent(scene, avatarID);

            // clean up leftovers...
            var avService = scene.AvatarService;

            avService.ResetAvatar(avatarID);

            var rootFolder = scene.InventoryService.GetRootFolder(avatarID);

            if (rootFolder != null)
            {
                scene.InventoryService.ForcePurgeFolder(rootFolder);
            }

            MainConsole.Instance.InfoFormat("[BotManager]: Removed bot {0} from region {1}",
                                            sp.Name, scene.RegionInfo.RegionName);
        }
        public bool UpdateAgent(GridRegion destination, AgentData agentData)
        {
            if (destination == null || Scene == null || agentData == null)
            {
                return(false);
            }

            bool retVal = false;
            IEntityTransferModule transferModule = Scene.RequestModuleInterface <IEntityTransferModule>();

            if (transferModule != null)
            {
                retVal = transferModule.IncomingChildAgentDataUpdate(Scene, agentData);
            }

            //            MainConsole.Instance.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle);
            return(retVal);
        }
 public void IncurDamage(IScenePresence killingAvatar, double damage, string RegionName, Vector3 pos,
                         Vector3 lookat)
 {
     if (damage < 0)
     {
         return;
     }
     if (InnerIncurDamage(killingAvatar, damage, false))
     {
         //They died, teleport them
         IEntityTransferModule entityTransfer = m_SP.Scene.RequestModuleInterface <IEntityTransferModule> ();
         if (entityTransfer != null)
         {
             entityTransfer.RequestTeleportLocation(m_SP.ControllingClient, RegionName, pos, lookat,
                                                    (uint)TeleportFlags.ViaHome);
         }
     }
 }
Beispiel #29
0
        public void OnTeleportLureRequest(UUID lureID, uint teleportFlags, IClientAPI client)
        {
            ulong handle;
            uint  x;
            uint  y;
            uint  z;

            Util.ParseFakeParcelID(lureID, out handle, out x, out y, out z);

            Vector3 position = new Vector3 {
                X = x, Y = y, Z = z
            };
            IEntityTransferModule entityTransfer = client.Scene.RequestModuleInterface <IEntityTransferModule> ();

            if (entityTransfer != null)
            {
                GridInstantMessage im;
                if (m_PendingLures.TryGetValue(lureID, out im))
                {
                    string[] parts = im.message.Split(new[] { '@' });
                    if (parts.Length > 1)
                    {
                        string url = parts[parts.Length - 1]; // the last part
                        if (url.Trim(new[] { '/' }) != GetMainGridURL().Trim(new[] { '/' }))
                        {
                            GridRegion gatekeeper = new GridRegion
                            {
                                ServerURI = url,
                                RegionID  = im.RegionID,
                                Flags     =
                                    (int)
                                    (Framework.RegionFlags.Foreign |
                                     Framework.RegionFlags.Hyperlink)
                            };
                            entityTransfer.RequestTeleportLocation(client, gatekeeper, position,
                                                                   Vector3.Zero, teleportFlags);
                            return;
                        }
                    }
                }
                entityTransfer.RequestTeleportLocation(client, handle, position,
                                                       Vector3.Zero, teleportFlags);
            }
        }
Beispiel #30
0
        /// <summary>
        /// This is the method that shuts down the scene.
        /// </summary>
        public void Close()
        {
            m_log.InfoFormat("[Scene]: Closing down the single simulator: {0}", RegionInfo.RegionName);

            // Kick all ROOT agents with the message, 'The simulator is going down'
            ForEachScenePresence(delegate(IScenePresence avatar)
            {
                if (!avatar.IsChildAgent)
                {
                    avatar.ControllingClient.Kick("The simulator is going down.");
                }
            });

            IEntityTransferModule transferModule = RequestModuleInterface <IEntityTransferModule> ();

            if (transferModule != null)
            {
                foreach (IScenePresence avatar in GetScenePresences())
                {
                    transferModule.IncomingCloseAgent(this, avatar.UUID);
                }
            }
            ShouldRunHeartbeat = false; //Stop the heartbeat
            //Now close the tracker
            monitor.Stop();

            if (m_sceneGraph.PhysicsScene != null)
            {
                m_sceneGraph.PhysicsScene.Dispose();
            }

            //Tell the neighbors that this region is now down
            INeighborService service = RequestModuleInterface <INeighborService>();

            if (service != null)
            {
                service.InformNeighborsThatRegionIsDown(RegionInfo);
            }

            // Stop updating the scene objects and agents.
            shuttingdown = true;

            m_sceneGraph.Close();
        }
Beispiel #31
0
 /// <summary>
 /// Sets up references to modules required by the scene
 /// </summary>
 public void SetModuleInterfaces()
 {
     m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
     m_worldCommModule = RequestModuleInterface<IWorldComm>();
     XferManager = RequestModuleInterface<IXfer>();
     m_AvatarFactory = RequestModuleInterface<IAvatarFactoryModule>();
     AttachmentsModule = RequestModuleInterface<IAttachmentsModule>();
     m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
     m_dialogModule = RequestModuleInterface<IDialogModule>();
     m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
     m_teleportModule = RequestModuleInterface<IEntityTransferModule>();
     m_groupsModule = RequestModuleInterface<IGroupsModule>();
 }
        private const double TIMEOUT = 1.0; // time in cache

        public SimulatorFeaturesHelper(Scene scene, IEntityTransferModule et)
        {
            m_scene = scene;
            m_TransferModule = et;
        }
Beispiel #33
0
        /// <summary>
        /// Sets up references to modules required by the scene
        /// </summary>
        public void SetModuleInterfaces()
        {
            m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
            m_worldCommModule = RequestModuleInterface<IWorldComm>();
            XferManager = RequestModuleInterface<IXfer>();
            m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
            AttachmentsModule = RequestModuleInterface<IAttachmentsModule>();
            m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
            m_dialogModule = RequestModuleInterface<IDialogModule>();
            m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
            m_teleportModule = RequestModuleInterface<IEntityTransferModule>();

            // Shoving this in here for now, because we have the needed
            // interfaces at this point
            //
            // TODO: Find a better place for this
            //
            while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
            {
                MainConsole.Instance.Output("The current estate " + m_regInfo.EstateSettings.EstateName + " has no owner set.");
                List<char> excluded = new List<char>(new char[1] { ' ' });
                string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
                string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);

                UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);

                if (account == null)
                {
                    // Create a new account
                    account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty);
                    if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0))
                    {
                        account.ServiceURLs = new Dictionary<string, object>();
                        account.ServiceURLs["HomeURI"] = string.Empty;
                        account.ServiceURLs["GatekeeperURI"] = string.Empty;
                        account.ServiceURLs["InventoryServerURI"] = string.Empty;
                        account.ServiceURLs["AssetServerURI"] = string.Empty;
                    }

                    if (UserAccountService.StoreUserAccount(account))
                    {
                        string password = MainConsole.Instance.PasswdPrompt("Password");
                        string email = MainConsole.Instance.CmdPrompt("Email", "");

                        account.Email = email;
                        UserAccountService.StoreUserAccount(account);

                        bool success = false;
                        success = AuthenticationService.SetPassword(account.PrincipalID, password);
                        if (!success)
                            m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.",
                               first, last);

                        GridRegion home = null;
                        if (GridService != null)
                        {
                            List<GridRegion> defaultRegions = GridService.GetDefaultRegions(UUID.Zero);
                            if (defaultRegions != null && defaultRegions.Count >= 1)
                                home = defaultRegions[0];

                            if (GridUserService != null && home != null)
                                GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
                            else
                                m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
                                   first, last);

                        }
                        else
                            m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
                               first, last);

                        if (InventoryService != null)
                            success = InventoryService.CreateUserInventory(account.PrincipalID);
                        if (!success)
                            m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
                               first, last);


                        m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last);

                        m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
                        m_regInfo.EstateSettings.Save();
                    }
                    else
                        m_log.ErrorFormat("[SCENE]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first.");
                }
                else
                {
                    m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
                    m_regInfo.EstateSettings.Save();
                }
            }
        }