Esempio n. 1
0
        /// <inheritdoc />
        public TorchServer(TorchConfig config = null)
        {
            DedicatedInstance = new InstanceManager(this);
            AddManager(DedicatedInstance);
            AddManager(new EntityControlManager(this));
            Config = config ?? new TorchConfig();

            var sessionManager = Managers.GetManager <ITorchSessionManager>();

            sessionManager.AddFactory(x => new MultiplayerManagerDedicated(this));
        }
Esempio n. 2
0
        public TorchClient()
        {
            Config = new TorchClientConfig();
            var sessionManager = Managers.GetManager <ITorchSessionManager>();

            sessionManager.AddFactory((x) => MyMultiplayer.Static is MyMultiplayerLobby
                ? new MultiplayerManagerLobby(this)
                : null);
            sessionManager.AddFactory((x) => MyMultiplayer.Static is MyMultiplayerClientBase
                ? new MultiplayerManagerClient(this)
                : null);
        }
Esempio n. 3
0
        /// <inheritdoc />
        public virtual void Init()
        {
            Debug.Assert(!_init, "Torch instance is already initialized.");
            SpaceEngineersGame.SetupBasicGameInfo();
            SpaceEngineersGame.SetupPerGameSettings();
            ObjectFactoryInitPatch.ForceRegisterAssemblies();

            Debug.Assert(MyPerGameSettings.BasicGameInfo.GameVersion != null, "MyPerGameSettings.BasicGameInfo.GameVersion != null");
            GameVersion = new MyVersion(MyPerGameSettings.BasicGameInfo.GameVersion.Value);

            try
            {
                Console.Title = $"{Config.InstanceName} - Torch {TorchVersion}, SE {GameVersion}";
            }
            catch
            {
                // Running without a console
            }

#if DEBUG
            Log.Info("DEBUG");
#else
            Log.Info("RELEASE");
#endif
            Log.Info($"Torch Version: {TorchVersion}");
            Log.Info($"Game Version: {GameVersion}");
            Log.Info($"Executing assembly: {Assembly.GetEntryAssembly().FullName}");
            Log.Info($"Executing directory: {AppDomain.CurrentDomain.BaseDirectory}");

            Managers.GetManager <PluginManager>().LoadPlugins();
            Game = new VRageGame(this, TweakGameSettings, SteamAppName, SteamAppId, Config.InstancePath, RunArgs);
            if (!Game.WaitFor(VRageGame.GameState.Stopped))
            {
                Log.Warn("Failed to wait for game to be initialized");
            }
            Managers.Attach();
            _init = true;

            if (GameState >= TorchGameState.Created && GameState < TorchGameState.Unloading)
            {
                // safe to commit here; all important static ctors have run
                PatchManager.CommitInternal();
            }
        }
Esempio n. 4
0
        /// <inheritdoc />
        public TorchServer(TorchConfig config = null)
        {
            DedicatedInstance = new InstanceManager(this);
            AddManager(DedicatedInstance);
            AddManager(new EntityControlManager(this));
            AddManager(new RemoteAPIManager(this));
            Config = config ?? new TorchConfig();

            var sessionManager = Managers.GetManager <ITorchSessionManager>();

            sessionManager.AddFactory(x => new MultiplayerManagerDedicated(this));

            // Needs to be done at some point after MyVRageWindows.Init
            // where the debug listeners are registered
            if (!((TorchConfig)Config).EnableAsserts)
            {
                MyDebug.Listeners.Clear();
            }
        }
Esempio n. 5
0
 /// <inheritdoc />
 public virtual void Update()
 {
     Managers.GetManager <IPluginManager>().UpdatePlugins();
 }