public override void LoadData() { //if (true) return; Static = this; if (!MyFakes.ENABLE_ASTEROID_FIELDS) { return; } var settings = MySession.Static.Settings; if (settings.ProceduralDensity == 0f) { Enabled = false; MySandboxGame.Log.WriteLine("Skip Procedural World Generator"); return; } m_seed = settings.ProceduralSeed; m_objectDensity = MathHelper.Clamp(settings.ProceduralDensity * 2 - 1, -1, 1); // must be -1..1 MySandboxGame.Log.WriteLine(string.Format("Loading Procedural World Generator: Seed = '{0}' = {1}, Density = {2}", settings.ProceduralSeed, m_seed, settings.ProceduralDensity)); using (MyRandom.Instance.PushSeed(m_seed)) { m_asteroidsModule = new MyProceduralAsteroidCellGenerator(m_seed, m_objectDensity); m_modules.Add(m_asteroidsModule); } Enabled = true; }
public override void LoadData() { //if (true) return; Static = this; if (!MyFakes.ENABLE_ASTEROID_FIELDS) return; var settings = MySession.Static.Settings; if (settings.ProceduralDensity == 0f) { Enabled = false; MySandboxGame.Log.WriteLine("Skip Procedural World Generator"); return; } m_seed = settings.ProceduralSeed; m_objectDensity = MathHelper.Clamp(settings.ProceduralDensity * 2 - 1, -1, 1); // must be -1..1 MySandboxGame.Log.WriteLine(string.Format("Loading Procedural World Generator: Seed = '{0}' = {1}, Density = {2}", settings.ProceduralSeed, m_seed, settings.ProceduralDensity)); using (MyRandom.Instance.PushSeed(m_seed)) { if (MySession.Static.Settings.EnablePlanets) { var planets = new MyProceduralPlanetCellGenerator(m_seed, m_objectDensity); m_modules.Add(planets); var asteroids = new MyProceduralAsteroidCellGenerator(m_seed, m_objectDensity, planets); m_modules.Add(asteroids); } else { m_modules.Add(new MyProceduralAsteroidCellGenerator(m_seed, m_objectDensity)); } } Enabled = true; }