public IScene StartNewRegion(RegionInfo regionInfo)
        {
            MainConsole.Instance.InfoFormat("[SceneManager]: Starting region \"{0}\" at @ {1},{2}", regionInfo.RegionName,
                                            regionInfo.RegionLocX / 256, regionInfo.RegionLocY / 256);
            ISceneLoader sceneLoader = m_OpenSimBase.ApplicationRegistry.RequestModuleInterface <ISceneLoader> ();

            if (sceneLoader == null)
            {
                throw new Exception("No Scene Loader Interface!");
            }

            //Get the new scene from the interface
            IScene scene = sceneLoader.CreateScene(regionInfo);

#if (!ISWIN)
            foreach (IScene loadedScene in m_localScenes)
            {
                if (loadedScene.RegionInfo.RegionName == regionInfo.RegionName && loadedScene.RegionInfo.RegionHandle == regionInfo.RegionHandle)
                {
                    throw new Exception("Duplicate region!");
                }
            }
#else
            if (m_localScenes.Any(loadedScene => loadedScene.RegionInfo.RegionName == regionInfo.RegionName &&
                                  loadedScene.RegionInfo.RegionHandle == regionInfo.RegionHandle))
            {
                throw new Exception("Duplicate region!");
            }
#endif
            StartNewRegion(scene);
            return(scene);
        }
Exemple #2
0
        public void StartRegion(ISimulationDataStore simData, RegionInfo regionInfo)
        {
            MainConsole.Instance.InfoFormat("[SceneManager]: Starting region \"{0}\" at @ {1},{2}",
                                            regionInfo.RegionName,
                                            regionInfo.RegionLocX / 256, regionInfo.RegionLocY / 256);
            ISceneLoader sceneLoader = m_SimBase.ApplicationRegistry.RequestModuleInterface <ISceneLoader>();

            if (sceneLoader == null)
            {
                throw new Exception("No Scene Loader Interface!");
            }

            //Get the new scene from the interface
            IScene scene = sceneLoader.CreateScene(simData, regionInfo);

            m_scenes.Add(scene);

            MainConsole.Instance.ConsoleScenes = m_scenes;
            simData.SetRegion(scene);
            m_simulationDataServices.Add(simData);

            if (OnAddedScene != null)
            {
                OnAddedScene(scene);
            }

            StartModules(scene);

            if (OnFinishedAddingScene != null)
            {
                OnFinishedAddingScene(scene);
            }

            //Start the heartbeats
            scene.StartHeartbeat();
            //Tell the scene that the startup is complete
            // Note: this event is added in the scene constructor
            scene.FinishedStartup("Startup", new List <string>());
        }