Ejemplo n.º 1
0
        protected override void OnChatMessage(ref ChatMsg msg)
        {
            if (m_memberData.ContainsKey(msg.Author))
            {
                if (m_memberData[msg.Author].IsAdmin)
                {
                    if (msg.Text.ToLower().Contains("+unban"))
                    {
                        string[] parts = msg.Text.Split(' ');
                        if (parts.Length > 1)
                        {
                            ulong user = 0;
                            if (ulong.TryParse(parts[1], out user))
                            {
                                BanClient(user, false);
                            }
                        }
                    }
                    else if (msg.Text.ToLower() == "+reload")
                    {
                        MySandboxGame.ReloadDedicatedServerSession();
                    }
                }
            }

            RaiseChatMessageReceived(msg.Author, msg.Text, ChatEntryTypeEnum.ChatMsg);
        }
        public MyGuiScreenMainMenu(bool pauseGame)
            : base(Vector2.Zero, null, null)
        {
            if (MyGuiScreenGamePlay.Static == null)
            {
                m_closeOnEsc = false;
            }
            else
            {
                m_pauseGame = pauseGame;
                if (m_pauseGame && MySandboxGame.IsPaused == false)
                {
                    MySandboxGame.UserPauseToggle();
                }
            }

            //if (MyGuiScreenGamePlay.Static.GetGameType() == MyGuiScreenGamePlayType.MAIN_MENU) m_closeOnEsc = false;
            //if (MyGuiScreenGamePlay.Static.IsPausable()) MySandboxGame.SwitchPause();

            //Because then it is visible under credits, help, etc..
            m_drawEvenWithoutFocus = false;

            if (MyGuiScreenGamePlay.Static == null)
            {
                //We dont want to load last session if we end up game in main menu
                MyLocalCache.SaveLastSessionInfo(null);
            }

            try
            {
                m_newsSerializer = new XmlSerializer(typeof(MyNews));
            }
            catch { };
        }
Ejemplo n.º 3
0
 protected void CheckLowMemSwitchToLow()
 {
     if (MySandboxGame.Config.LowMemSwitchToLow != MyConfig.LowMemSwitch.TRIGGERED)
     {
         return;
     }
     MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Error, MyMessageBoxButtonsType.YES_NO, messageCaption : MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), messageText : MyTexts.Get(MySpaceTexts.LowMemSwitchToLowQuestion), okButtonText : null, cancelButtonText : null, yesButtonText : null, noButtonText : null, callback : delegate(MyGuiScreenMessageBox.ResultEnum result)
     {
         if (result == MyGuiScreenMessageBox.ResultEnum.YES)
         {
             MySandboxGame.Config.LowMemSwitchToLow = MyConfig.LowMemSwitch.ARMED;
             MySandboxGame.Config.SetToLowQuality();
             MySandboxGame.Config.Save();
             if (MySpaceAnalytics.Instance != null)
             {
                 MySpaceAnalytics.Instance.ReportSessionEnd("Exit to Windows");
             }
             MyScreenManager.CloseAllScreensNowExcept(null, isUnloading: true);
             MySandboxGame.ExitThreadSafe();
         }
         else
         {
             MySandboxGame.Config.LowMemSwitchToLow = MyConfig.LowMemSwitch.USER_SAID_NO;
             MySandboxGame.Config.Save();
         }
     }));
 }
Ejemplo n.º 4
0
        public SpaceEngineersCore()
        {
            var    contentPath  = ToolboxUpdater.GetApplicationContentPath();
            string userDataPath = SpaceEngineersConsts.BaseLocalPath.DataPath;

            MyFileSystem.Reset();
            MyFileSystem.Init(contentPath, userDataPath);

            MyLog.Default        = MySandboxGame.Log;
            MySandboxGame.Config = new MyConfig("SpaceEngineers.cfg"); // TODO: Is specific to SE, not configurable to ME.
            MySandboxGame.Config.Load();

            MyFileSystem.InitUserSpecific(null);

            SpaceEngineersGame.SetupPerGameSettings();

            VRageRender.MyRenderProxy.Initialize(new MyNullRender());
            // We create a whole instance of MySandboxGame!
            MySandboxGame gameTemp = new MySandboxGame(null);

            // creating MySandboxGame will reset the CurrentUICulture, so I have to reapply it.
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfoByIetfLanguageTag(GlobalSettings.Default.LanguageCode);
            SpaceEngineersApi.LoadLocalization();

            _stockDefinitions = new SpaceEngineersResources();
            _stockDefinitions.LoadDefinitions();
            _manageDeleteVoxelList = new List <string>();
        }
        static void RunInternal()
        {
            MyFileSystem.InitUserSpecific(null);

            VRageRender.MyRenderProxy.Initialize(MySandboxGame.IsDedicated ? (IMyRender) new MyNullRender() : new MyDX9Render());
            VRageRender.MyRenderProxy.IS_OFFICIAL = MyFinalBuildConstants.IS_OFFICIAL;

            using (MySteamService steamService = new MySteamService(MySandboxGame.IsDedicated, MyPerServerSettings.AppId))
            {
                if (!steamService.HasGameServer)
                {
                    MyLog.Default.WriteLineAndConsole("Steam service is not running! Please reinstall dedicated server.");
                    return;
                }

                VRageGameServices services = new VRageGameServices(steamService);

                using (MySandboxGame game = new MySandboxGame(services, Environment.GetCommandLineArgs().Skip(1).ToArray()))
                {
                    VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
                    VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();

                    game.Run();
                }

                if (MySandboxGame.IsConsoleVisible)
                {
                    Console.WriteLine("Server stopped, press any key to close this window");
                    Console.ReadKey(false);
                }
            }
        }
Ejemplo n.º 6
0
 private static void CleanupSandbox()
 {
     m_steamService.Dispose();
     m_spacegame.Dispose();
     m_steamService = null;
     m_spacegame    = null;
 }
Ejemplo n.º 7
0
        public void Run(VRageGameServices services, IntPtr windowHandle, bool customRenderLoop = false, MySandboxGame game = null)
        {
            MyLog.Default = MySandboxGame.Log;

            if (game == null)
            {
                Static = new MySandboxExternal(this, services, null, windowHandle);
            }
            else
            {
                Static = game;
            }

            Initialize(Static);



            //Sandbox.Definitions.MyDefinitionManager.Static.LoadData(new List<Sandbox.Common.ObjectBuilders.MyObjectBuilder_Checkpoint.ModItem>());

            //Static.In
            Static.OnGameLoaded += GameLoaded;
            Static.OnGameExit   += GameExit;

            //GameLoaded(this, null);

            Static.Run(customRenderLoop);

            //LoadDefinitions();

            if (!customRenderLoop)
            {
                Dispose();
            }
        }
        public void AddTrigger(MyTriggerComponent trigger)
        {
            Debug.Assert(trigger != null, "Horrible Assertion! Call a programmer! Hurry!");
            MySandboxGame.AssertUpdateThread();

            if (Contains(trigger))
            {
                return;
            }

            using (m_dictionaryLock.AcquireExclusiveUsing())
            {
                CachingHashSet triggerSet;
                if (m_triggers.TryGetValue((MyEntity)trigger.Entity, out triggerSet))
                {
                    triggerSet.Add(trigger);
                }
                else
                {
                    m_triggers[(MyEntity)trigger.Entity] = new CachingHashSet {
                        trigger
                    };
                }
            }
        }
Ejemplo n.º 9
0
        public void UpdateClip()
        {
            //GR: Catch exception when closing. Happens on synchronized rendering
            try
            {
                MySandboxGame.GameWindowHandle = Handle;
            }
            catch (ObjectDisposedException)
            {
                MySandboxGame.ExitThreadSafe();
                return;
            }
            // TODO: OP! Some old implementation, try finding something more safe
            Control c = Control.FromHandle(WinApi.GetForegroundWindow());

            bool isActive = false;

            if (c != null)
            {
                isActive = !c.TopLevelControl.InvokeRequired &&
                           Handle == c.TopLevelControl.Handle;
            }

            isActive = isActive && (m_captureMouse || !m_isCursorVisible);

            if (isActive)
            {
                SetClip();
            }
            else
            {
                ClearClip();
            }
        }
Ejemplo n.º 10
0
 protected void CheckLowMemSwitchToLow()
 {
     if (MySandboxGame.Config.LowMemSwitchToLow == MyConfig.LowMemSwitch.TRIGGERED)
     {
         MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                    callback : delegate(MyGuiScreenMessageBox.ResultEnum result)
         {
             if (result == MyGuiScreenMessageBox.ResultEnum.YES)
             {
                 MySandboxGame.Config.LowMemSwitchToLow = MyConfig.LowMemSwitch.ARMED;
                 MySandboxGame.Config.SetToLowQuality();
                 MySandboxGame.Config.Save();
                 // Exit game
                 {
                     MyAnalyticsTracker.SendGameEnd("Exit to Windows", MySandboxGame.TotalTimeInMilliseconds / 1000);
                     MyScreenManager.CloseAllScreensNowExcept(null);
                     MySandboxGame.ExitThreadSafe();
                 }
             }
             else
             {
                 MySandboxGame.Config.LowMemSwitchToLow = MyConfig.LowMemSwitch.USER_SAID_NO;
                 MySandboxGame.Config.Save();
             };
         },
                                    messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError),
                                    messageText: MyTexts.Get(MySpaceTexts.LowMemSwitchToLowQuestion),
                                    buttonType: MyMessageBoxButtonsType.YES_NO));
     }
 }
Ejemplo n.º 11
0
 public void ExitCallback(MyGuiScreenMessageBox.ResultEnum callbackReturn)
 {
     if (callbackReturn == MyGuiScreenMessageBox.ResultEnum.YES)
     {
         MyScreenManager.CloseAllScreensNowExcept(null);
         MySandboxGame.ExitThreadSafe();
     }
 }
Ejemplo n.º 12
0
 internal static void ServerConsoleOnInput(string input)
 {
     //if (!string.IsNullOrEmpty(input)) ConsoleManager.Instance.ExecuteCommand(input);
     if (input.ToLower().Equals("quit") || input.ToLower().Equals("shutdown"))
     {
         MySandboxGame.ExitThreadSafe();
     }
 }
Ejemplo n.º 13
0
 protected override void OnClosed()
 {
     if (MySandboxGame.IsPaused)
     {
         MySandboxGame.UserPauseToggle();
     }
     base.OnClosed();
 }
Ejemplo n.º 14
0
 private void TorchOnGameStateChanged(MySandboxGame game, TorchGameState newstate)
 {
     if (newstate == TorchGameState.Loading && MySandboxGame.ConfigDedicated.RemoteApiEnabled && !string.IsNullOrEmpty(MySandboxGame.ConfigDedicated.RemoteSecurityKey))
     {
         var myRemoteServer = new MyRemoteServer(MySandboxGame.ConfigDedicated.RemoteApiPort, MySandboxGame.ConfigDedicated.RemoteSecurityKey);
         LogManager.GetCurrentClassLogger().Info($"Remote API started on port {myRemoteServer.Port}");
     }
 }
Ejemplo n.º 15
0
        private void DoRestart()
        {
            // Tell SE to shut down
            //Wrapper.GameAction( ()=>MySandboxGame.Static.Exit(  ) );
            //MySandboxGame.Static.Exit(  );
            //Thread.Sleep( 5000 );

            Essentials.Log.Info("Stopping server");

            //cache for console output while we're waiting
            StringBuilder sb  = new StringBuilder();
            TextWriter    tw  = new StringWriter(sb);
            TextWriter    tmp = Console.Out;

            //hijack the console so we can listen for the server stopped message
            Console.SetOut(tw);

            //ask the server nicely to stop
            MySandboxGame.ExitThreadSafe();

            DateTime waitStart = DateTime.Now;

            while (true)
            {
                if (sb.ToString().Contains("Server stopped, press any key to close this window"))
                {
                    break;
                }

                Thread.Sleep(100);

                //the server didn't listen, so kill it forcefully
                if (DateTime.Now - waitStart > TimeSpan.FromMinutes(5))
                {
                    Essentials.Log.Warn("Server failed to shut down correctly!");
                    break;
                }
            }

            //return control back to the console and write the cached log back
            Console.SetOut(tmp);
            Console.Write(sb);

            // If we're not a service, restart with a .bat otherwise just exit and let the service be restarted
            if (Environment.UserInteractive)
            {
                string restartText = "%windir%/system32/timeout /t 30\r\n";
                restartText += String.Format("cd /d \"{0}\"\r\n", Path.GetDirectoryName(Application.ExecutablePath));
                restartText += PluginSettings.Instance.RestartAddedProcesses + "\r\n";
                restartText += Path.GetFileName(Application.ExecutablePath) + " " + Server.Instance.CommandLineArgs.Args + "\r\n";

                File.WriteAllText("RestartApp.bat", restartText);
                Process.Start("RestartApp.bat");
            }

            Environment.Exit(1);
        }
Ejemplo n.º 16
0
 void GameStateChanged(MySandboxGame game, TorchGameState state)
 {
     if (state != TorchGameState.Created)
     {
         return;
     }
     // not necessary after 1.196
     // API.Register();
 }
Ejemplo n.º 17
0
        private void OnLogoutProgressClosed()
        {
            MySandboxGame.Log.WriteLine("Application closed by user");
            MyAnalyticsTracker.SendGameEnd("Exit to Windows", MySandboxGame.TotalTimeInMilliseconds / 1000);
            MyScreenManager.CloseAllScreensNowExcept(null);

            //  Exit application
            MySandboxGame.ExitThreadSafe();
        }
Ejemplo n.º 18
0
        public SpaceEngineersCore()
        {
            var    contentPath  = ToolboxUpdater.GetApplicationContentPath();
            string userDataPath = SpaceEngineersConsts.BaseLocalPath.DataPath;

            MyFileSystem.Reset();
            MyFileSystem.Init(contentPath, userDataPath);

            MyLog.Default        = MySandboxGame.Log;
            MySandboxGame.Config = new MyConfig("SpaceEngineers.cfg"); // TODO: Is specific to SE, not configurable to ME.
            MySandboxGame.Config.Load();

            MyFileSystem.InitUserSpecific(null);

            SpaceEngineersGame.SetupPerGameSettings();

            VRageRender.MyRenderProxy.Initialize(new MyNullRender());
            // We create a whole instance of MySandboxGame!
            // If this is causing an exception, then there is a missing dependency.
            MySandboxGame gameTemp = new MySandboxGame(new string[] { "-skipintro" });

            // creating MySandboxGame will reset the CurrentUICulture, so I have to reapply it.
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfoByIetfLanguageTag(GlobalSettings.Default.LanguageCode);
            SpaceEngineersApi.LoadLocalization();
            MyStorageBase.UseStorageCache = false;

            #region MySession creation

            // Replace the private constructor on MySession, so we can create it without getting involed with Havok and other depdancies.
            var keenStart = typeof(Sandbox.Game.World.MySession).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(MySyncLayer), typeof(bool) }, null);
            var ourStart  = typeof(SEToolbox.Interop.MySession).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(MySyncLayer), typeof(bool) }, null);
            ReflectionUtil.ReplaceMethod(ourStart, keenStart);

            // Create an empty instance of MySession for use by low level code.
            Sandbox.Game.World.MySession mySession = ReflectionUtil.ConstructPrivateClass <Sandbox.Game.World.MySession>(new Type[0], new object[0]);
            ReflectionUtil.ConstructField(mySession, "m_sessionComponents"); // Required as the above code doesn't populate it during ctor of MySession.
            mySession.Settings = new MyObjectBuilder_SessionSettings {
                EnableVoxelDestruction = true
            };

            VRage.MyVRage.Init(new ToolboxPlatform());

            // change for the Clone() method to use XML cloning instead of Protobuf because of issues with MyObjectBuilder_CubeGrid.Clone()
            ReflectionUtil.SetFieldValue(typeof(VRage.ObjectBuilders.MyObjectBuilderSerializer), "ENABLE_PROTOBUFFERS_CLONING", false);

            // Assign the instance back to the static.
            Sandbox.Game.World.MySession.Static = mySession;

            Sandbox.Game.GameSystems.MyHeightMapLoadingSystem.Static = new MyHeightMapLoadingSystem();
            Sandbox.Game.GameSystems.MyHeightMapLoadingSystem.Static.LoadData();

            #endregion

            _stockDefinitions = new SpaceEngineersResources();
            _stockDefinitions.LoadDefinitions();
            _manageDeleteVoxelList = new List <string>();
        }
Ejemplo n.º 19
0
        public void StopServer( )
        {
            if (!_isServerRunning)
            {
                return;
            }

            ApplicationLog.BaseLog.Info("Stopping server");

            //cache for console output while we're waiting
            StringBuilder sb  = new StringBuilder();
            TextWriter    tw  = new StringWriter(sb);
            TextWriter    tmp = Console.Out;

            //hijack the console so we can listen for the server stopped message
            Console.SetOut(tw);

            //ask the server nicely to stop
            MySandboxGame.ExitThreadSafe();

            _pluginMainLoop.Stop( );
            _autosaveTimer.Stop( );
            _pluginManager.Shutdown( );

            DateTime waitStart = DateTime.Now;

            while (true)
            {
                if (sb.ToString().Contains("Server stopped, press any key to close this window"))
                {
                    break;
                }

                Thread.Sleep(100);

                //the server didn't listen, so kill it forcefully
                if (DateTime.Now - waitStart > TimeSpan.FromMinutes(5))
                {
                    ApplicationLog.BaseLog.Warn("Server failed to shut down correctly!");
                    break;
                }
            }

            //return control back to the console and write the cached log back
            Console.SetOut(tmp);
            Console.Write(sb);

            //_runServerThread.Interrupt();
            //_dedicatedServerWrapper.StopServer();
            //_runServerThread.Abort();
            //_runServerThread.Interrupt( );

            _isServerRunning = false;

            ApplicationLog.BaseLog.Info("Server has been stopped");
        }
Ejemplo n.º 20
0
 void MySession_AfterLoading()
 {
     GrabWhitelist(_commandLine);
     GrabTerminalActions(_commandLine);
     Task.Run(async() =>
     {
         await Task.Delay(TimeSpan.FromSeconds(5));
         MySandboxGame.ExitThreadSafe();
     });
 }
        public override bool Update(bool hasFocus)
        {
            if (!hasFocus)
            {
                return(base.Update(hasFocus));
            }

            if (m_childScreenLaunched && hasFocus)
            {
                CloseScreenNow();
            }

            if (m_childScreenLaunched)
            {
                return(base.Update(hasFocus));
            }

            if (MyInput.Static.IsKeyPress(MyKeys.Escape))
            {
                MyGuiScreenMainMenu.ReturnToMainMenu();
                return(base.Update(hasFocus));
            }

            switch (m_quickLaunchType)
            {
            case MyQuickLaunchType.LAST_SANDBOX:
            {
                var lastSessionPath = MyLocalCache.GetLastSessionPath();
                if (lastSessionPath != null && System.IO.Directory.Exists(lastSessionPath))
                {
                    MyGuiScreenLoadSandbox.LoadSingleplayerSession(lastSessionPath);
                }
                else
                {
                    MySandboxGame.AfterLogos();
                }
                m_childScreenLaunched = true;
            }
            break;

            case MyQuickLaunchType.NEW_SANDBOX:
            {
                MyGuiScreenStartSandbox.QuickstartSandbox(null);
                m_childScreenLaunched = true;
            }
            break;

            default:
            {
                throw new InvalidBranchException();
            }
            }

            return(base.Update(hasFocus));
        }
Ejemplo n.º 22
0
 private void OnGameStateChanged(MySandboxGame game, TorchGameState newState)
 {
     if ((newState & TorchGameState.Loaded) == TorchGameState.Loaded)
     {
         Torch.Managers.GetManager(typeof(PBProfilerManager)).Attach();
     }
     else if ((newState & TorchGameState.Unloading) != 0)
     {
         Torch.Managers.GetManager(typeof(PBProfilerManager)).Detach();
     }
 }
Ejemplo n.º 23
0
        public void Init(object gameInstance)
        {
            HaEAssemblyResolver.ResolveAssembliesIn(new DirectoryInfo(Path.GetDirectoryName(typeof(HaEPluginCore).Assembly.Location)));
            CreateDirectories();

            instance        = (MySandboxGame)gameInstance;
            HaEInputHandler = new HaEInputHandler();
            pluginCore      = this;

            HaEDefaultBindings.BindKeys();
            OnInit?.Invoke();
        }
Ejemplo n.º 24
0
 internal static void ServerConsoleOnInput(string input)
 {
     input = input.Trim();
     if (!string.IsNullOrEmpty(input))
     {
         // TODO: Handle command input
         if (input.ToLower().Equals("quit") || input.ToLower().Equals("shutdown"))
         {
             MySandboxGame.ExitThreadSafe();
         }
     }
 }
Ejemplo n.º 25
0
    public override bool CloseScreen(bool isUnloading = false)
    {
        if (m_pauseGame && !Sync.MultiplayerActive)
        {
            MySandboxGame.PausePop();
        }
        bool result = base.CloseScreen(isUnloading);

        m_firstLoadup = false;
        m_musicPlayed = false;
        return(result);
    }
Ejemplo n.º 26
0
 private void OnLogoutProgressClosed()
 {
     MySandboxGame.Config.ControllerDefaultOnStart = MyInput.Static.IsJoystickLastUsed;
     MySandboxGame.Config.Save();
     MySandboxGame.Log.WriteLine("Application closed by user");
     if (MySpaceAnalytics.Instance != null)
     {
         MySpaceAnalytics.Instance.ReportSessionEnd("Exit to Windows");
     }
     MyScreenManager.CloseAllScreensNowExcept(null);
     MySandboxGame.ExitThreadSafe();
 }
Ejemplo n.º 27
0
 public void PauseClient(bool pause)
 {
     if (pause)
     {
         MySandboxGame.PausePush();
         MyHud.Notifications.Add(MyNotificationSingletons.ConnectionProblem);
     }
     else
     {
         MySandboxGame.PausePop();
         MyHud.Notifications.Remove(MyNotificationSingletons.ConnectionProblem);
     }
 }
Ejemplo n.º 28
0
        public MyGuiScreenMedicals()
            : base(new Vector2(0.85f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.95f, 0.8f))
        {
            Static = this;
            EnabledBackgroundFade = true;
            CloseButtonEnabled    = false;
            m_closeOnEsc          = false;
            m_selectedRespawnShip = null;

            RecreateControls(true);

            MySandboxGame.PausePush();
        }
Ejemplo n.º 29
0
        private void OnGameStateChanged(MySandboxGame game, TorchGameState newstate)
        {
            switch (newstate)
            {
            case TorchGameState.Creating:
                var instanceManager = Torch
                                      .Managers
                                      .GetManager(typeof(InstanceManager)) as InstanceManager;

                instanceManager?.DedicatedConfig.Mods
                .Add(new ModItemInfo(new MyObjectBuilder_Checkpoint.ModItem(1772298664)));
                break;
            }
        }
        public override void UpdateBeforeSimulation()
        {
            if (Enabled)
            {
                ProfilerShort.Begin("Add tracked entities");
                if (m_toAddTrackedEntities.Count != 0)
                {
                    foreach (var pair in m_toAddTrackedEntities)
                    {
                        m_trackedEntities.Add(pair.Key, pair.Value);
                    }
                    m_toAddTrackedEntities.Clear();
                }

                ProfilerShort.BeginNextBlock("Update tracked entities");
                foreach (var tracker in m_trackedEntities.Values)
                {
                    if (tracker.ShouldGenerate())
                    {
                        var oldBoundingVolume = tracker.BoundingVolume;
                        tracker.UpdateLastPosition();

                        foreach (var module in m_modules)
                        {
                            ProfilerShort.Begin("GenerateObjectsInSphere");
                            module.GetObjectSeeds(tracker.BoundingVolume, m_tempObjectSeedList);
                            module.GenerateObjects(m_tempObjectSeedList, m_existingObjectsSeeds);
                            m_tempObjectSeedList.Clear();
                            ProfilerShort.End();

                            module.MarkCellsDirty(oldBoundingVolume, tracker.BoundingVolume);
                        }
                    }
                }

                ProfilerShort.BeginNextBlock("Process dirty cells");
                foreach (var module in m_modules)
                {
                    module.ProcessDirtyCells(m_trackedEntities);
                }
                ProfilerShort.End();
            }

            if (!MySandboxGame.AreClipmapsReady && MySession.Static.VoxelMaps.Instances.Count == 0)
            {
                // Render will not send any message if it has no clipmaps, so we have to specify there is nothing to wait for.
                MySandboxGame.SignalClipmapsReady();
            }
        }
Ejemplo n.º 31
0
        static void RunInternal()
        {
            MyFileSystem.InitUserSpecific(null);

            VRageRender.MyRenderProxy.Initialize(MySandboxGame.IsDedicated ? (IMyRender) new MyNullRender() : new MyDX9Render());
            VRageRender.MyRenderProxy.IS_OFFICIAL = MyFinalBuildConstants.IS_OFFICIAL;

            using (MySteamService steamService = new MySteamService(MySandboxGame.IsDedicated, AppId))
            {
                if (!steamService.HasGameServer)
                {
                    MyLog.Default.WriteLineAndConsole("Steam service is not running! Please reinstall dedicated server.");
                    return;
                }

                VRageGameServices services = new VRageGameServices(steamService);

                using (MySandboxGame game = new MySandboxGame(services, new string[] { }))
                {
                    VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();
                    VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();

                    game.Run();
                }

                if (MySandboxGame.IsConsoleVisible)
                {
                    Console.WriteLine("Server stopped, press any key to close this window");
                    Console.ReadKey(false);
                }
            }
        }