public override MyHeightCubemap GetHeightmap() { MyHeightCubemap heightMap; MyHeightMapLoadingSystem component = MySession.Static.GetComponent <MyHeightMapLoadingSystem>(); if (component == null) { return(this.GetHeightMap(this.m_path, this.m_mod)); } if (!component.TryGet(this.m_path, out heightMap)) { heightMap = this.GetHeightMap(this.m_path, this.m_mod); component.Cache(this.m_path, ref heightMap); } return(heightMap); }
public override MyCubemap[] GetMaps(MyPlanetMapTypeSet types) { MyCubemap[] cubemapArray; MyHeightMapLoadingSystem component = MySession.Static.GetComponent <MyHeightMapLoadingSystem>(); if (component == null) { this.GetPlanetMaps(this.m_path, this.m_mod, types, out cubemapArray); } else if (!component.TryGet(this.m_path, out cubemapArray)) { this.GetPlanetMaps(this.m_path, this.m_mod, types, out cubemapArray); component.Cache(this.m_path, ref cubemapArray); } return(cubemapArray); }
public SpaceEngineersCore() { var contentPath = ToolboxUpdater.GetApplicationContentPath(); string userDataPath = SpaceEngineersConsts.BaseLocalPath.DataPath; MyFileSystem.ExePath = Path.GetDirectoryName(Assembly.GetAssembly(typeof(FastResourceLock)).Location); MyLog.Default = MySandboxGame.Log; SpaceEngineersGame.SetupBasicGameInfo(); _startup = new MyCommonProgramStartup(new string[] { }); //var appDataPath = _startup.GetAppDataPath(); //MyInitializer.InvokeBeforeRun(AppId, MyPerGameSettings.BasicGameInfo.ApplicationName + "SEToolbox", appDataPath); //MyInitializer.InitCheckSum(); MyFileSystem.Reset(); MyFileSystem.Init(contentPath, userDataPath); // This will start the Steam Service, and Steam will think SE is running. // TODO: we don't want to be doing this all the while SEToolbox is running, // perhaps a once off during load to fetch of mods then disconnect/Dispose. _steamService = MySteamGameService.Create(MySandboxGame.IsDedicated, AppId); MyServiceManager.Instance.AddService(_steamService); IMyUGCService serviceInstance = MySteamUgcService.Create(AppId, _steamService); MyServiceManager.Instance.AddService(serviceInstance); MyFileSystem.InitUserSpecific(_steamService.UserId.ToString()); // This sets the save file/path to load games from. //MyFileSystem.InitUserSpecific(null); //SpaceEngineersWorkshop.MySteam.Dispose(); MySandboxGame.Config = new MyConfig("SpaceEngineers.cfg"); // TODO: Is specific to SE, not configurable to ME. MySandboxGame.Config.Load(); SpaceEngineersGame.SetupPerGameSettings(); VRage.MyVRage.Init(new ToolboxPlatform()); VRage.MyVRage.Platform.Init(); MySandboxGame.InitMultithreading(); 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 DerivedGame(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; // Create an empty instance of MySession for use by low level code. var mySession = (Sandbox.Game.World.MySession)FormatterServices.GetUninitializedObject(typeof(Sandbox.Game.World.MySession)); // Required as the above code doesn't populate it during ctor of MySession. ReflectionUtil.ConstructField(mySession, "m_creativeTools"); ReflectionUtil.ConstructField(mySession, "m_sessionComponents"); ReflectionUtil.ConstructField(mySession, "m_sessionComponentsForUpdate"); mySession.Settings = new MyObjectBuilder_SessionSettings { EnableVoxelDestruction = true }; // 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; var heightMapLoadingSystem = new MyHeightMapLoadingSystem(); mySession.RegisterComponent(heightMapLoadingSystem, heightMapLoadingSystem.UpdateOrder, heightMapLoadingSystem.Priority); heightMapLoadingSystem.LoadData(); _stockDefinitions = new SpaceEngineersResources(); _stockDefinitions.LoadDefinitions(); _manageDeleteVoxelList = new List <string>(); }