diff --git a/SEWorldGenPlugin/GUI/PluginWorldSettings.cs b/SEWorldGenPlugin/GUI/PluginWorldSettings.cs index 4618652..3d5cb2d 100644 --- a/SEWorldGenPlugin/GUI/PluginWorldSettings.cs +++ b/SEWorldGenPlugin/GUI/PluginWorldSettings.cs @@ -131,7 +131,7 @@ protected override void BuildControls() if (m_isNewGame) { - PlSettings = new MyObjectBuilder_PluginSettings(); + PlSettings = MySettings.Static.Settings; PlSettings.GeneratorSettings.PlanetSettings.BlacklistedPlanets = MySettings.Static.Settings.GeneratorSettings.PlanetSettings.BlacklistedPlanets; PlSettings.GeneratorSettings.PlanetSettings.Moons = MySettings.Static.Settings.GeneratorSettings.PlanetSettings.Moons; PlSettings.GeneratorSettings.PlanetSettings.MandatoryPlanets = MySettings.Static.Settings.GeneratorSettings.PlanetSettings.MandatoryPlanets; diff --git a/SEWorldGenPlugin/Generator/SystemGenerator.cs b/SEWorldGenPlugin/Generator/SystemGenerator.cs index 49b21d7..4865d3b 100644 --- a/SEWorldGenPlugin/Generator/SystemGenerator.cs +++ b/SEWorldGenPlugin/Generator/SystemGenerator.cs @@ -136,8 +136,12 @@ private void GenerateSystem() { if (tmp_distance >= m_settings.WorldSize && m_settings.WorldSize > 0) return; - int distToPrev = MyRandom.Instance.Next(m_settings.MinOrbitDistance, m_settings.MaxOrbitDistance); - tmp_distance += distToPrev; + if (i != 0 || !m_settings.FirstPlanetCenter) + { + int distToPrev = MyRandom.Instance.Next(m_settings.MinOrbitDistance, m_settings.MaxOrbitDistance); + tmp_distance += distToPrev; + } + if(MyRandom.Instance.NextDouble()/* * ((i % 6) * (i % 6) / 12.5)*/ < 1 - m_settings.BeltSettings.BeltProbability && m_planetDefinitions.Count != 0){ GeneratePlanet(i, tmp_distance, numberPlanets, ref totalPlanets); @@ -182,7 +186,11 @@ private void GeneratePlanet(int index, long distance, int totalObjects, ref int { MyPlanetItem planet = new MyPlanetItem(); - var def = GetPlanetDefinition((int)(m_settings.PlanetSettings.PlanetSizeCap * Math.Sin(index * Math.PI / totalObjects))); + double mod = distance == 0 && m_settings.FirstPlanetCenter ? 1 : Math.Sin(index * Math.PI / totalObjects); + + var def = GetPlanetDefinition((int)(m_settings.PlanetSettings.PlanetSizeCap * mod)); + + var size = SizeByGravity(def.SurfaceGravity); var angle = MyRandom.Instance.GetRandomFloat(0, (float)(2 * Math.PI)); var height = MyRandom.Instance.GetRandomFloat((float)Math.PI / 180 * -5, (float)Math.PI / 180 * 5); @@ -191,7 +199,7 @@ private void GeneratePlanet(int index, long distance, int totalObjects, ref int planet.DisplayName = "Planet " + (++planetIndex); planet.Type = SystemObjectType.PLANET; planet.DefName = def.Id.SubtypeId.String; - planet.Size = SizeByGravity(def.SurfaceGravity); + planet.Size = size; planet.PlanetRing = GenerateRing(def.SurfaceGravity, planet.Size); planet.OffsetPosition = pos; planet.CenterPosition = pos; @@ -262,7 +270,7 @@ private MyPlanetGeneratorDefinition GetPlanetDefinition(float maximumSize) size = SizeByGravity(def.SurfaceGravity); tries++; - } while (size >= maximumSize && tries < 10000); + } while (size > maximumSize && tries < 10000); return def; } @@ -302,7 +310,6 @@ private void ShuffleMandatoryPlanets() int n = m_mandatoryPlanets.Count; while(n > 1) { - n--; int index = MyRandom.Instance.Next(n - 1); var value = m_mandatoryPlanets[index]; m_mandatoryPlanets[index] = m_mandatoryPlanets[n]; diff --git a/SEWorldGenPlugin/ObjectBuilders/MyObjectBuilder_PluginSettings.cs b/SEWorldGenPlugin/ObjectBuilders/MyObjectBuilder_PluginSettings.cs index 85734bd..4bdb4e7 100644 --- a/SEWorldGenPlugin/ObjectBuilders/MyObjectBuilder_PluginSettings.cs +++ b/SEWorldGenPlugin/ObjectBuilders/MyObjectBuilder_PluginSettings.cs @@ -41,6 +41,7 @@ public GeneratorSettings() BeltSettings = new BeltSettings(); SemiRandomizedGeneration = false; WorldSize = -1; + FirstPlanetCenter = false; } [ProtoMember(1)] @@ -73,6 +74,9 @@ public GeneratorSettings() [ProtoMember(10)] public long WorldSize; + [ProtoMember(10)] + public bool FirstPlanetCenter; + public void Verify() { Verifier.VerifyInt(0, MaxObjectsInSystem, 5, "MinObjectsInSystem", ref MinObjectsInSystem);