diff --git a/GalacticScale2/DSP_Plugins.GalacticScale.csproj b/GalacticScale2/DSP_Plugins.GalacticScale.csproj
index e70c2401..380a6cab 100644
--- a/GalacticScale2/DSP_Plugins.GalacticScale.csproj
+++ b/GalacticScale2/DSP_Plugins.GalacticScale.csproj
@@ -162,9 +162,6 @@
-
-
-
@@ -282,6 +279,7 @@
+
@@ -290,6 +288,7 @@
+
diff --git a/GalacticScale2/Properties/AssemblyInfo.cs b/GalacticScale2/Properties/AssemblyInfo.cs
index e9d3b7da..3f04c911 100644
--- a/GalacticScale2/Properties/AssemblyInfo.cs
+++ b/GalacticScale2/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.85.1")]
-[assembly: AssemblyFileVersion("2.0.85.1")]
\ No newline at end of file
+[assembly: AssemblyVersion("2.0.85.3")]
+[assembly: AssemblyFileVersion("2.0.85.3")]
\ No newline at end of file
diff --git a/GalacticScale2/Scripts/Assets/galacticbundle b/GalacticScale2/Scripts/Assets/galacticbundle
index 647d79d9..55abb33d 100644
Binary files a/GalacticScale2/Scripts/Assets/galacticbundle and b/GalacticScale2/Scripts/Assets/galacticbundle differ
diff --git a/GalacticScale2/Scripts/Bootstrap.cs b/GalacticScale2/Scripts/Bootstrap.cs
index 69865894..48d7b643 100644
--- a/GalacticScale2/Scripts/Bootstrap.cs
+++ b/GalacticScale2/Scripts/Bootstrap.cs
@@ -7,7 +7,7 @@
namespace GalacticScale
{
- [BepInPlugin("dsp.galactic-scale.2", "Galactic Scale 2 Plug-In", "2.0.85.1")]
+ [BepInPlugin("dsp.galactic-scale.2", "Galactic Scale 2 Plug-In", "2.0.85.3")]
[BepInDependency("space.customizing.console", BepInDependency.DependencyFlags.SoftDependency)]
public class Bootstrap : BaseUnityPlugin
{
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/Galaxy Generation/ProcessGalaxy.cs b/GalacticScale2/Scripts/GalacticScale2.0/Galaxy Generation/ProcessGalaxy.cs
index 3c518793..32224103 100644
--- a/GalacticScale2/Scripts/GalacticScale2.0/Galaxy Generation/ProcessGalaxy.cs
+++ b/GalacticScale2/Scripts/GalacticScale2.0/Galaxy Generation/ProcessGalaxy.cs
@@ -26,6 +26,7 @@ public static GalaxyData ProcessGalaxy(GameDesc desc, bool sketchOnly = false)
Log("Seed From gameDesc = " + GSSettings.Seed);
gsPlanets.Clear();
gsStars.Clear();
+
//Warn("Cleared");
Warn("Loading Data from Generator : " + ActiveGenerator.Name);
ActiveGenerator.Generate(gameDesc.starCount);
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2/GS2Generator.cs b/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2/GS2Generator.cs
deleted file mode 100644
index ae0833a0..00000000
--- a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2/GS2Generator.cs
+++ /dev/null
@@ -1,732 +0,0 @@
-using System;
-using System.Collections.Generic;
-using UnityEngine;
-using static GalacticScale.GS2;
-using static GalacticScale.RomanNumbers;
-
-namespace GalacticScale.Generators
-{
- public partial class GS2Generator : iConfigurableGenerator
- {
- private GSPlanet birthPlanet;
- private GSPlanet birthPlanetHost;
- private int birthPlanetIndex = -1;
- private bool birthPlanetIsMoon;
- private GSStar birthStar;
- private float maxStepLength = 3.5f;
- private float minDistance = 2f;
-
-
- private float minStepLength = 2.3f;
-
- private GS2.Random random;
- public string Name => "GalacticScale";
-
- public string Author => "innominata";
-
- public string Description => "The Galactic Scale 2 Generator";
-
- public string Version => "0.0";
-
- public string GUID => "space.customizing.generators.gs2";
-
- public void Generate(int starCount, StarData birthStar = null)
- {
- Log($"Start {GSSettings.Seed}");
- GSSettings.Reset(GSSettings.Seed);
- SetupBaseThemes();
- InitThemes();
- GSSettings.GalaxyParams.graphDistance = 32;
- GSSettings.GalaxyParams.graphMaxStars = 512;
- //starCount = preferences.GetInt("defaultStarCount", 64);
- SetGalaxyDensity(preferences.GetInt("galaxyDensity", 5));
- random = new GS2.Random(GSSettings.Seed);
- CalculateFrequencies();
- Log("Generating Stars");
- for (var i = 0; i < starCount; i++)
- {
- var starType = ChooseStarType();
- var star = new GSStar(random.Next(), SystemNames.GetName(i), starType.spectr, starType.type,
- new GSPlanets());
- if (star.Type != EStarType.BlackHole) star.radius *= preferences.GetFloat("starSizeMulti", 10f);
- if (star.Type == EStarType.BlackHole && preferences.GetFloat("starSizeMulti", 10f) < 2.1f)
- star.radius *= preferences.GetFloat("starSizeMulti", 10f);
- //Warn($"Habitable zone for {star.Name} {Utils.CalculateHabitableZone(star.luminosity)}");
- GSSettings.Stars.Add(star);
- GeneratePlanetsForStar(star);
- }
-
- Log("Picking BirthPlanet");
- PickNewBirthPlanet();
- Log("Birthplanet Picked");
- if (!preferences.GetBool("birthPlanetUnlock", true)) birthPlanet.Theme = "Mediterranean";
- Log((birthPlanet != null).ToString());
- GSSettings.BirthPlanetName = birthPlanet.Name;
- Log("BirthPlanet Set");
- if (preferences.GetBool("birthPlanetSiTi")) AddSiTiToBirthPlanet();
-
- if (preferences.GetInt("birthPlanetSize", 400) != birthPlanet.Radius)
- {
- Log("Forcing BirthPlanet Size");
- //int oldRadius = birthPlanet.Radius;
- var newRadius = preferences.GetInt("birthPlanetSize", 400);
-
- if (birthPlanet.Radius < newRadius) //We have a problem with orbits!
- {
- Log("Fixing Orbits...");
- FixOrbitsForBirthPlanet(newRadius);
- }
-
- birthPlanet.Radius = newRadius;
- birthPlanet.Scale = 1f;
- }
- //Log("Logging BirthPlanet Json");
- //LogJson(birthPlanet, true);
-
- Log("End");
- foreach (var star in GSSettings.Stars)
- {
- //GS2.Warn($"DysonRadius for star {star.Name} is {star.dysonRadius}");
- star.dysonRadius =
- star.dysonRadius * Mathf.Clamp(preferences.GetFloat("starSizeMulti", 10f), 0.5f, 100f);
- foreach (var body in star.Bodies)
- foreach (var m in body.Moons)
- if (m.Radius > body.Radius && body.Scale != 10f)
- Warn(
- $"RADIUS ERROR {m.Name} radius {m.Radius} greater than {body.Name} radius of {body.Radius} Theme:{body.Theme}");
- }
-
- EnsureBirthSystemHasTi();
- GSSettings.BirthPlanetName = birthPlanet.Name;
- }
-
-
- private void EnsureBirthSystemHasTi()
- {
- if (!BirthSystemHasTi())
- {
- if (birthStar.TelluricBodyCount < 2)
- {
- if (!GSSettings.ThemeLibrary.ContainsKey("AshenGelisol")) Themes.AshenGelisol.Process();
- var tiPlanet = birthStar.Planets.Add(new GSPlanet("Black Swan", "AshenGelisol",
- GetStarPlanetSize(birthStar), GetOrbitGap(birthStar) * birthStar.PlanetCount, 0f, 100000f, 0f,
- 0f, 360f, 0f, -1f));
- tiPlanet.OrbitalPeriod =
- Utils.CalculateOrbitPeriodFromStarMass(tiPlanet.OrbitRadius, birthStar.mass);
- return;
- }
-
- var p = birthPlanet;
- while (p == birthPlanet) p = random.Item(birthStar.TelluricBodies);
- p.Theme = "AshenGelisol";
- }
- }
-
- private bool BirthSystemHasTi()
- {
- foreach (var p in birthStar.Bodies)
- if (p.GsTheme.VeinSettings.VeinTypes.ContainsVein(EVeinType.Titanium))
- return true;
- return false;
- }
-
- private void FixOrbitsForBirthPlanet(int newRadius)
- {
- var radiusDifference = newRadius - birthPlanet.Radius;
- var newRadiusAU = newRadius * 0.000025f;
- var auRadiusDifference = radiusDifference * 0.000025f;
- if (birthPlanet.MoonCount > 0)
- for (var i = 0; i < birthPlanet.MoonCount; i++)
- if (birthPlanet.Moons[i].OrbitRadius + birthPlanet.Moons[i].SystemRadius > newRadiusAU)
- {
- birthPlanet.Moons.RemoveRange(0, i + 1);
- Log($"Fixed birthplanet orbits by removing {i + 1} moons");
- return;
- }
-
- //Is the birthPlanet a moon?
- if (birthPlanetIsMoon)
- {
- //Can we solve this by removing sub moons?
- if (birthPlanet.MoonCount > 0)
- for (var i = 0; i < birthPlanet.MoonCount; i++)
- if (birthPlanet.Moons[i].OrbitRadius + birthPlanet.Moons[i].SystemRadius > newRadiusAU)
- {
- birthPlanet.Moons.RemoveRange(0, i + 1);
- Log($"Fixed birthplanet orbits by removing {i + 1} sub moons");
- return;
- }
-
- //Can we solve this by removing host moons?
- if (birthPlanetHost.MoonCount > 1)
- {
- var cumulativeSystemRadii = 0.0;
- for (var i = birthPlanetIndex - 1; i > 0; i--)
- {
- // check in towards the host
- cumulativeSystemRadii += birthPlanetHost.Moons[i].SystemRadius;
- if (cumulativeSystemRadii > auRadiusDifference)
- {
- birthPlanetHost.Moons.RemoveRange(i, birthPlanetIndex - i);
- birthPlanet.OrbitRadius -= auRadiusDifference;
- Log($"Fixed birthplanet orbits by removing {birthPlanetIndex - i} host moons on inside");
- }
- }
-
- cumulativeSystemRadii = 0.0;
- for (var i = birthPlanetIndex + 1; i < birthPlanetHost.MoonCount; i++)
- {
- // check out away from the host
- cumulativeSystemRadii += birthPlanetHost.Moons[i].SystemRadius;
- if (cumulativeSystemRadii > auRadiusDifference)
- {
- birthPlanetHost.Moons.RemoveRange(birthPlanetIndex + 1, i - birthPlanetIndex);
- birthPlanet.OrbitRadius -= auRadiusDifference;
- Log($"Fixed birthplanet orbits by removing {i - birthPlanetIndex} host moons on outside");
- }
- }
- }
-
- //Can we solve this by making the host smaller?
- if (birthPlanetHost.Scale == 1f && birthPlanetHost.RadiusAU > auRadiusDifference)
- {
- birthPlanetHost.Radius -= radiusDifference;
- Log("Fixed birthplanet orbits by making host planet smaller");
- return;
- }
-
- if (birthPlanetHost.Scale == 10f && birthPlanetHost.RadiusAU > auRadiusDifference)
- {
- var reduction = Mathf.Max(Utils.ParsePlanetSize(radiusDifference / 10), 10);
- birthPlanetHost.Radius -= reduction;
- Warn("Fixed birthplanet orbits by making host planet smaller");
- return;
- }
- }
-
- //Is the birthPlanet a planet?
- if (!birthPlanetIsMoon)
- {
- //Fix by moving all orbits out
- for (var i = birthPlanetIndex; i < birthStar.PlanetCount; i++)
- {
- birthStar.Planets[i].OrbitRadius += 2 * auRadiusDifference;
- birthPlanet.OrbitRadius -= auRadiusDifference;
- }
-
- Log(
- $"Fixed birthplanet orbits by adding size difference to orbit radius for all planets at or above index {birthPlanetIndex}");
- return;
- }
-
- Error("Failed to adjust orbits for birthPlanet Increased Size");
- }
-
- public void SetGalaxyDensity(int density)
- {
- switch (density)
- {
- case 1:
- minStepLength = 1.2f;
- maxStepLength = 1.5f;
- minDistance = 1.2f;
- break;
- case 2:
- minStepLength = 1.4f;
- maxStepLength = 2f;
- minDistance = 1.5f;
- break;
- case 3:
- minStepLength = 1.6f;
- maxStepLength = 2.5f;
- minDistance = 1.7f;
- break;
- case 4:
- minStepLength = 1.8f;
- maxStepLength = 3f;
- minDistance = 2f;
- break;
- case 5:
- minStepLength = 2f;
- maxStepLength = 3.5f;
- minDistance = 2.3f;
- break;
- case 6:
- minStepLength = 2.2f;
- maxStepLength = 4.2f;
- minDistance = 2.4f;
- break;
- case 7:
- minStepLength = 2.5f;
- maxStepLength = 5.0f;
- minDistance = 2.6f;
- break;
- case 8:
- minStepLength = 2.7f;
- maxStepLength = 6.0f;
- minDistance = 2.8f;
- break;
- case 9:
- minStepLength = 3.0f;
- maxStepLength = 7.0f;
- minDistance = 3.0f;
- break;
- default:
- minStepLength = 2f;
- maxStepLength = 3.5f;
- minDistance = 2.3f;
- break;
- }
-
- GSSettings.GalaxyParams.minDistance = minDistance;
- GSSettings.GalaxyParams.minStepLength = minStepLength;
- GSSettings.GalaxyParams.maxStepLength = maxStepLength;
- }
-
- private int GetStarPlanetCount(GSStar star)
- {
- var min = GetMinPlanetCountForStar(star);
- var max = GetMaxPlanetCountForStar(star);
- //int result = random.NextInclusive(min, max);
- var result = ClampedNormal(min, max, GetCountBiasForStar(star));
- //Log($"{star.Name} count :{result} min:{min} max:{max}");
- return result;
- }
-
- private int GetStarPlanetSize(GSStar star)
- {
- var min = GetMinPlanetSizeForStar(star);
- var max = GetMaxPlanetSizeForStar(star);
- var bias = GetSizeBiasForStar(star);
- //float average = ((max - (float)min) / 2) + min;
- //int range = max - min;
- //float sd = (float)range / 6;
- //return Mathf.Clamp(Utils.ParsePlanetSize(random.Normal(average, sd)), min, max);
- return ClampedNormalSize(min, max, bias);
- }
-
- private int ClampedNormal(int min, int max, int bias)
- {
- var range = max - min;
- var average = bias / 100f * range + min;
- var sdHigh = (max - average) / 3;
- var sdLow = (average - min) / 3;
- var sd = Math.Max(sdLow, sdHigh);
- var rResult = Mathf.RoundToInt(random.Normal(average, sd));
- var result = Mathf.Clamp(rResult, min, max);
- //Warn($"ClampedNormal min:{min} max:{max} bias:{bias} range:{range} average:{average} sdHigh:{sdHigh} sdLow:{sdLow} sd:{sd} fResult:{fResult} result:{result}");
- return result;
- }
-
- private float ClampedNormal(float min, float max, int bias)
- {
- var range = max - min;
- var average = bias / 100f * range + min;
- var sdHigh = (max - average) / 3;
- var sdLow = (average - min) / 3;
- var sd = Math.Max(sdLow, sdHigh);
- var rResult = random.Normal(average, sd);
- var result = Mathf.Clamp(rResult, min, max);
- //Warn($"ClampedNormal min:{min} max:{max} bias:{bias} range:{range} average:{average} sdHigh:{sdHigh} sdLow:{sdLow} sd:{sd} fResult:{fResult} result:{result}");
- return result;
- }
-
- private int ClampedNormalSize(int min, int max, int bias)
- {
- var range = max - min;
- var average = bias / 100f * range + min;
- var sdHigh = (max - average) / 3;
- var sdLow = (average - min) / 3;
- var sd = Math.Max(sdLow, sdHigh);
- var fResult = random.Normal(average, sd);
- var result = Mathf.Clamp(Utils.ParsePlanetSize(fResult), min, max);
- //Warn($"ClampedNormal min:{min} max:{max} bias:{bias} range:{range} average:{average} sdHigh:{sdHigh} sdLow:{sdLow} sd:{sd} fResult:{fResult} result:{result}");
- return result;
- }
-
- private int GetStarMoonSize(GSStar star, int hostRadius, bool hostGas)
- {
- if (hostGas) hostRadius *= 10;
- var min = Utils.ParsePlanetSize(GetMinPlanetSizeForStar(star));
- int max;
- if (preferences.GetBool("moonsAreSmall", true))
- {
- float divider = 2;
- if (hostGas) divider = 4;
- max = Utils.ParsePlanetSize(Mathf.RoundToInt(hostRadius / divider));
- }
- else
- {
- max = Utils.ParsePlanetSize(hostRadius - 10);
- }
-
- if (max <= min) return min;
- float average = (max - min) / 2 + min;
- var range = max - min;
- var sd = (float) range / 4;
- //int size = Utils.ParsePlanetSize(random.Next(min, max));
- var size = ClampedNormalSize(min, max, GetSizeBiasForStar(star));
- //if (size > hostRadius)
- //{
- //Warn($"MoonSize {size} selected for {star.Name} moon with host size {hostRadius} avg:{average} sd:{sd} max:{max} min:{min} range:{range} hostGas:{hostGas}");
- // size = Utils.ParsePlanetSize(hostRadius - 10);
- //}
- return size;
- }
-
- private void GeneratePlanetsForStar(GSStar star)
- {
- star.Planets = new GSPlanets();
- var starBodyCount = GetStarPlanetCount(star);
- if (starBodyCount == 0) return;
- var moonChance = GetMoonChanceForStar(star);
- var moonCount = 0;
- var secondaryMoonCount = 0;
- var protos = new List();
- var moons = new List();
- protos.Add(new ProtoPlanet {gas = CalculateIsGas(star), radius = GetStarPlanetSize(star)});
- if (protos[0].radius < 50) protos[0].radius = 50;
- for (var i = 1; i < starBodyCount; i++)
- if (random.NextPick(moonChance))
- {
- moonCount++;
- }
- else
- {
- var p = new ProtoPlanet {gas = CalculateIsGas(star), radius = GetStarPlanetSize(star)};
-
- if (p.gas)
- {
- if (!preferences.GetBool("hugeGasGiants", true)) p.radius = 80;
- if (p.radius < 50)
- //Warn("Setting radius to 50 for gas");
- p.radius = 50;
- }
-
- protos.Add(p);
- }
-
- for (var i = 0; i < Math.Min(2, protos.Count); i++)
- if (protos[i].gas && protos[i].radius > 80) //GS2.Warn("RADIUS 80");
- protos[i].radius = 80;
- //if (protos[i].radius > 300)
- //{
- // protos[i].radius = Mathf.Clamp(300, GetMinPlanetSizeForStar(star), GetMaxPlanetSizeForStar(star));
- // //GS2.Warn("Clamping Radius");
- //}
- for (var i = 0; i < moonCount; i++)
- if (preferences.GetBool("secondarySatellites") && random.NextPick(moonChance) && i != 0)
- {
- secondaryMoonCount++; // i != 0 Make sure we have at least one actual satellite
- }
- else
- {
- var randomProto = random.Item(protos);
- var moon = new ProtoPlanet
- {gas = false, radius = GetStarMoonSize(star, randomProto.radius, randomProto.gas)};
- randomProto.moons.Add(moon);
- moons.Add(moon);
- }
-
- for (var i = 0; i < secondaryMoonCount; i++)
- {
- var randomMoon = random.Item(moons);
- randomMoon.moons.Add(new ProtoPlanet {radius = GetStarMoonSize(star, randomMoon.radius, false)});
- }
-
- foreach (var proto in protos)
- {
- if (proto.gas)
- if (proto.radius < 50)
- Warn("GAS AND NOT 50");
- var planet = new GSPlanet(star.Name + "-Planet", null, proto.radius, -1, -1, -1, -1, -1, -1, -1, -1);
- //planet.fields.Add("gas", proto.gas.ToString());
- if (proto.gas) planet.Scale = 10f;
- else planet.Scale = 1f;
- //Warn($"PlanetScale {planet.Name} {planet.Scale} {planet.Radius}");
- if (proto.moons.Count > 0) planet.Moons = new GSPlanets();
- foreach (var moon in proto.moons)
- {
- var planetMoon = new GSPlanet(star.Name + "-Moon", null, moon.radius, -1, -1, -1, -1, -1, -1, -1,
- -1);
- planetMoon.Scale = 1f;
- if (moon.moons.Count > 0) planetMoon.Moons = new GSPlanets();
- foreach (var moonmoon in moon.moons)
- {
- var moonMoon = new GSPlanet(star.Name + "-MoonMoon", null, moonmoon.radius, -1, -1, -1, -1, -1,
- -1, -1, -1);
- moonMoon.Scale = 1f;
- planetMoon.Moons.Add(moonMoon);
- }
-
- planet.Moons.Add(planetMoon);
- }
-
- star.Planets.Add(planet);
- }
-
- CreatePlanetOrbits(star);
- SelectPlanetThemes(star);
- FudgeNumbersForPlanets(star); // Probably want to revisit this :)
- }
-
- private void FudgeNumbersForPlanets(GSStar star)
- {
- foreach (var body in star.Bodies)
- {
- body.RotationPhase = random.Next(360);
- body.OrbitInclination = random.NextFloat() * 4 + random.NextFloat() * 5;
- if (!IsPlanetOfStar(star, body))
- body.OrbitInclination = (random.NextBool() ? 1 : -1) * (10f + random.NextFloat() * 50f);
- body.OrbitPhase = random.Next(360);
- body.Obliquity = random.NextFloat() * 20;
- body.RotationPeriod = random.Next(60, 3600);
- if (random.NextDouble() < 0.02) body.OrbitalPeriod = -1 * body.OrbitalPeriod; // Clockwise Rotation
- if (body.OrbitRadius < 1f && random.NextFloat() < 0.5f)
- body.RotationPeriod = body.OrbitalPeriod; // Tidal Lock
- else if (body.OrbitRadius < 1.5f && random.NextFloat() < 0.2f)
- body.RotationPeriod = body.OrbitalPeriod / 2; // 1:2 Resonance
- else if (body.OrbitRadius < 2f && random.NextFloat() < 0.1f)
- body.RotationPeriod = body.OrbitalPeriod / 4; // 1:4 Resonance
- if (random.NextDouble() < 0.05) // Crazy Obliquity
- body.Obliquity = random.NextFloat(20f, 85f);
- if (random.NextDouble() < 0.05) // Crazy Inclination
- body.OrbitInclination = random.NextFloat(20f, 85f);
-
- //// Force inclinations for testing
- //body.OrbitInclination = 0f;
- //body.OrbitPhase = 0f;
- //body.OrbitalPeriod = 10000000f;
- }
- }
-
- private void SelectPlanetThemes(GSStar star)
- {
- foreach (var planet in star.Planets)
- {
- var heat = CalculateThemeHeat(star, planet.OrbitRadius);
- var type = EThemeType.Planet;
- if (planet.Scale == 10f) type = EThemeType.Gas;
- planet.Theme = GSSettings.ThemeLibrary.Query(random, type, heat, planet.Radius);
- //Warn($"Planet Theme Selected. {planet.Name}:{planet.Theme} Radius:{planet.Radius * planet.Scale} {((planet.Scale == 10f) ? EThemeType.Gas : EThemeType.Planet)}");
- foreach (var body in planet.Bodies)
- if (body != planet)
- body.Theme = GSSettings.ThemeLibrary.Query(random, EThemeType.Moon, heat, body.Radius);
- //Warn($"Set Theme for {body.Name} to {body.Theme}");
- }
- }
-
- private float GetNextAvailableOrbit(GSPlanet planet, int MoonIndex)
- {
- var moons = planet.Moons;
- if (MoonIndex == 0) return planet.RadiusAU + moons[MoonIndex].SystemRadius;
- return moons[MoonIndex - 1].SystemRadius + moons[MoonIndex - 1].OrbitRadius + moons[MoonIndex].SystemRadius;
- }
-
- private void CreatePlanetOrbits(GSStar star)
- {
- // Now Work Backwards from secondary Satellites to Planets, creating orbits.
- for (var planetIndex = 0; planetIndex < star.PlanetCount; planetIndex++)
- {
- var planet = star.Planets[planetIndex];
- planet.Name = $"{star.Name} - {roman[planetIndex + 1]}";
- //For each Planet
- for (var moonIndex = 0; moonIndex < planet.MoonCount; moonIndex++)
- {
- var moon = planet.Moons[moonIndex];
- moon.Name = $"{star.Name} - {roman[planetIndex + 1]} - {roman[moonIndex + 1]}";
- //For Each Moon
- for (var moon2Index = 0; moon2Index < moon.MoonCount; moon2Index++)
- {
- //for each subsatellite
- //float m2orbit;
-
- var moon2 = moon.Moons[moon2Index];
- moon2.Name =
- $"{star.Name} - {roman[planetIndex + 1]} - {roman[moonIndex + 1]} - {roman[moon2Index + 1]}";
- moon2.OrbitRadius = GetMoonOrbit() / 2f + GetNextAvailableOrbit(moon, moon2Index);
- //Warn($"{moon2.Name} OrbitRadius:{moon2.OrbitRadius} Moon.SystemRadius:{moon.SystemRadius} Moon2.RadiusAU:{moon2.RadiusAU} ");
- moon2.OrbitalPeriod = Utils.CalculateOrbitPeriod(moon2.OrbitRadius);
- }
-
- moon.OrbitRadius = GetMoonOrbit() + GetNextAvailableOrbit(planet, moonIndex);
- //Warn($"{moon.Name} OrbitRadius:{moon.OrbitRadius} Planet.SystemRadius:{planet.SystemRadius} Moon.RadiusAU:{moon.RadiusAU} Planet Radius(AU):{planet.Radius}({planet.RadiusAU}) Planet Scale:{planet.Scale} Theme:{planet.Theme} ");
- moon.OrbitalPeriod = Utils.CalculateOrbitPeriod(moon.OrbitRadius);
- }
-
- float pOrbit;
- if (planetIndex == 0) pOrbit = star.RadiusAU * 1.5f + planet.SystemRadius;
- else
- pOrbit = star.Planets[planetIndex - 1].SystemRadius + GetOrbitGap(star) +
- star.Planets[planetIndex - 1].OrbitRadius + planet.SystemRadius;
- planet.OrbitRadius = pOrbit;
- //Warn($"{planet.Name} orbitRadius:{planet.OrbitRadius} systemRadius:{planet.SystemRadius} Planet Radius(AU):{planet.Radius}({planet.RadiusAU}) Planet Scale:{planet.Scale}");
- //if (planetIndex != 0) Warn($"pOrbit = {star.Planets[planetIndex - 1].SystemRadius} + {GetOrbitGap(star)} + {star.Planets[planetIndex - 1].OrbitRadius} + {planet.SystemRadius};");
- planet.OrbitalPeriod = Utils.CalculateOrbitPeriod(planet.OrbitRadius);
- }
- //Orbits should be set.
- }
-
- private float GetMoonOrbit()
- {
- return 0.02f + random.NextFloat(0f, 0.2f);
- }
-
- private float GetOrbitGap(GSStar star)
- {
- (float min, float max) hz = Utils.CalculateHabitableZone(star.luminosity);
- float pCount = star.Planets.Count;
- var maxOrbitByRadius = Mathf.Sqrt(star.radius);
- var maxOrbitByHabitableZone = 30f * hz.min;
- var maxOrbitByPlanetCount = 50f * pCount / 99f;
- var maxOrbit = Mathf.Max(maxOrbitByPlanetCount, maxOrbitByRadius, maxOrbitByHabitableZone);
- var averageOrbit = maxOrbit / pCount;
- var result = ClampedNormal(0.1f, maxOrbit / pCount, GetSystemDensityBiasForStar(star));
- //Warn($"Getting Orbit Gap for Star {star.Name} with {pCount} planets. Avg:{averageOrbit} MaxbyRadius:{maxOrbitByRadius} MaxbyPCount:{maxOrbitByPlanetCount} MaxByHZ:{maxOrbitByHabitableZone} Max:{maxOrbit} HabitableZone:{hz.Item1*10f}:{hz.Item2*10f} = {result}");
- return result; // random.NextFloat(0.1f, 2f * averageOrbit);
- }
-
- private void AddSiTiToBirthPlanet()
- {
- Warn("Setting SI/TI");
- birthPlanet.GsTheme.VeinSettings.Algorithm = "GS2";
- birthPlanet.GsTheme.CustomGeneration = true;
- birthPlanet.GsTheme.VeinSettings.VeinTypes.Add(GSVeinType.Generate(
- EVeinType.Silicium,
- 1, 10, 0.6f, 0.6f, 5, 10, false));
- birthPlanet.GsTheme.VeinSettings.VeinTypes.Add(GSVeinType.Generate(
- EVeinType.Titanium,
- 1, 10, 0.6f, 0.6f, 5, 10, false));
- }
-
- private void PickNewBirthPlanet()
- {
- if (GSSettings.StarCount == 0) Error("Cannot pick birth planet as there are 0 generated stars");
- //LogJson(GSSettings.Stars.HabitablePlanets, true);
-
- var HabitablePlanets = GSSettings.Stars.HabitablePlanets;
- if (HabitablePlanets.Count == 1)
- {
- birthPlanet = HabitablePlanets[0];
- birthStar = GetGSStar(birthPlanet);
- if (IsPlanetOfStar(birthStar, birthPlanet))
- {
- birthPlanetHost = null;
- Log($"Selected only habitable planet {birthPlanet.Name} as planet of {birthStar.Name}");
- return;
- }
-
- foreach (var planet in birthStar.Planets)
- foreach (var moon in planet.Moons)
- {
- if (moon == birthPlanet)
- {
- birthPlanetHost = planet;
- Log($"Selected only habitable planet {birthPlanet.Name} as moon of {birthStar.Name}");
- return;
- }
-
- if (IsMoonOfPlanet(moon, birthPlanet))
- {
- birthPlanetHost = moon;
- Log($"Selected only habitable planet {birthPlanet.Name} as submoon of {birthStar.Name}");
- return;
- }
- }
- }
-
- if (HabitablePlanets.Count == 0)
- {
- Log("Generating new habitable planet by overwriting an existing one");
- var star = GSSettings.Stars.RandomStar;
- var index = 0;
- //Warn("Getting index");
- if (star.PlanetCount > 1) index = Mathf.RoundToInt((star.PlanetCount - 1) / 2);
-
- var planet = star.Planets[index];
- //LogJson(planet, true);
- //Warn("Getting themeNames");
- var themeNames = GSSettings.ThemeLibrary.Habitable;
- //Warn($"Count = {themeNames.Count}");
- var themeName = themeNames[random.Next(themeNames.Count)];
- Log($"Setting Planet Theme to {themeName}");
- planet.Theme = themeName;
- //Warn("Setting birthPlanet");
- birthPlanet = planet;
- birthPlanetIndex = index;
- birthStar = star;
- Log($"Selected {birthPlanet.Name}");
- //LogJson(planet, true);
- }
- else if (HabitablePlanets.Count > 1)
- {
- Log("Selecting random habitable planet");
- birthPlanet = HabitablePlanets[random.Next(1, HabitablePlanets.Count - 1)];
- birthStar = GetGSStar(birthPlanet);
- for (var i = 0; i < birthStar.PlanetCount; i++)
- {
- if (birthStar.Planets[i] == birthPlanet)
- {
- birthPlanetIsMoon = false;
- birthPlanetIndex = i;
- Log($"Selected {birthPlanet.Name} as birthPlanet (planet) index {i} of star {birthStar.Name}");
- return;
- }
-
- for (var j = 0; j < birthStar.Planets[i].Moons.Count; j++)
- {
- if (birthStar.Planets[i].Moons[j] == birthPlanet)
- {
- birthPlanetIsMoon = true;
- birthPlanetHost = birthStar.Planets[i];
- birthPlanetIndex = j;
- Log(
- $"Selected {birthPlanet.Name} as birthPlanet (moon) index {j} of planet {birthPlanetHost.Name} ");
- return;
- }
-
- for (var k = 0; k < birthStar.Planets[i].Moons[j].Moons.Count; k++)
- if (birthStar.Planets[i].Moons[j].Moons[k] == birthPlanet)
- {
- birthPlanetIsMoon = true;
- birthPlanetHost = birthStar.Planets[i].Moons[j];
- birthPlanetIndex = k;
- Log(
- $"Selected {birthPlanet.Name} as birthPlanet (sub moon) index {k} of moon {birthPlanetHost.Name} ");
- return;
- }
- }
- }
-
-
- Error($"Selected {birthPlanet.Name} but failed to find a birthStar or host!");
- }
- }
-
- private bool CalculateIsGas(GSStar star)
- {
- var gasChance = GetGasChanceForStar(star);
- return random.NextPick(gasChance);
- }
-
- public static EThemeHeat CalculateThemeHeat(GSStar star, float OrbitRadius)
- {
- (float min, float max) hz = Utils.CalculateHabitableZone(star.luminosity);
- hz.max *= 5f;
- hz.min *= 10f;
- //Warn($"HZ for {star.Name} {hz.min}-{hz.max}");
- if (OrbitRadius < hz.max / 2) return EThemeHeat.Hot;
- if (OrbitRadius < hz.max) return EThemeHeat.Warm;
- if (OrbitRadius < hz.min) return EThemeHeat.Temperate;
- if (OrbitRadius < hz.min * 2) return EThemeHeat.Cold;
- return EThemeHeat.Frozen;
- }
-
- private class ProtoPlanet
- {
- public bool gas;
- public readonly List moons = new List();
- public int radius;
- }
- }
-}
\ No newline at end of file
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2/Settings.cs b/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2/Settings.cs
deleted file mode 100644
index 5e8db86c..00000000
--- a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2/Settings.cs
+++ /dev/null
@@ -1,633 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace GalacticScale.Generators
-{
- public partial class GS2Generator : iConfigurableGenerator
- {
- private readonly GSGenPreferences preferences = new GSGenPreferences();
- private Dictionary starFreq = new Dictionary();
-
- private readonly Dictionary
- typeCallbacks = new Dictionary();
-
- private readonly string[] typeDesc =
- {
- "Type K", "Type M", "Type F", "Type G", "Type A", "Type B", "Type O", "White Dwarf", "Red Giant",
- "Yellow Giant", "White Giant",
- "Blue Giant", "Neutron Star", "Black Hole"
- };
-
- private readonly string[] typeLetter =
- {"K", "M", "F", "G", "A", "B", "O", "WD", "RG", "YG", "WG", "BG", "NS", "BH"};
-
- public Dictionary UI = new Dictionary();
- public bool DisableStarCountSlider => false;
-
- public GSGeneratorConfig Config { get; } = new GSGeneratorConfig();
-
- public GSOptions Options { get; } = new GSOptions();
-
- public void Init()
- {
- AddUIElements();
- InitPreferences();
- }
-
- public void Import(GSGenPreferences preferences)
- {
- for (var i = 0; i < preferences.Count; i++)
- {
- var key = preferences.Keys.ElementAt(i);
- this.preferences.Set(key, preferences[key]);
- }
-
- Config.DefaultStarCount = preferences.GetInt("defaultStarCount");
- if (preferences.GetBool("ludicrousMode")) Config.MaxStarCount = 4096;
- else Config.MaxStarCount = 1024;
- }
-
- public GSGenPreferences Export()
- {
- return preferences;
- }
-
- private string GetTypeLetterFromStar(GSStar star)
- {
- switch (star.Type)
- {
- case EStarType.BlackHole: return "BH";
- case EStarType.NeutronStar: return "NS";
- case EStarType.WhiteDwarf: return "WD";
- case EStarType.GiantStar: return GetGiantStarTypeLetter(star.Spectr);
- case EStarType.MainSeqStar: return GetMainSeqStarTypeLetter(star.Spectr);
- }
-
- GS2.Error($"Failed to get star type letter from star of type {star.Type} spectr {star.Spectr}");
- return "WD";
- }
-
- private string GetMainSeqStarTypeLetter(ESpectrType spectr)
- {
- switch (spectr)
- {
- case ESpectrType.A: return "A";
- case ESpectrType.O: return "O";
- case ESpectrType.B: return "B";
- case ESpectrType.G: return "G";
- case ESpectrType.F: return "F";
- case ESpectrType.M: return "M";
- case ESpectrType.K: return "K";
- }
-
- GS2.Error($"Failed to get star type letter from main sequence star of spectr {spectr}");
- return "WD";
- }
-
- private string GetGiantStarTypeLetter(ESpectrType spectr)
- {
- switch (spectr)
- {
- case ESpectrType.A: return "WG";
- case ESpectrType.O:
- case ESpectrType.B: return "BG";
- case ESpectrType.G:
- case ESpectrType.F: return "YG";
- case ESpectrType.M:
- case ESpectrType.K: return "RG";
- }
-
- GS2.Error($"Failed to get star type letter from giant star of spectr {spectr}");
- return "WD";
- }
-
- public void EnableLudicrousMode()
- {
- Config.MaxStarCount = 4096;
- UI["safeMode"].Set(false);
- preferences.Set("safeMode", false);
- UI["starSizeMulti"].Set(new GSSliderConfig(0.1f, 10f, 100f));
- UI["minPlanetSize"].Set(new GSSliderConfig(5, 30, 500));
- UI["maxPlanetSize"].Set(new GSSliderConfig(50, 500, 510));
- UI["defaultStarCount"].Set(new GSSliderConfig(1, 64, 4096));
- UI["minPlanetCount"].Set(new GSSliderConfig(0, 1, 99));
- UI["maxPlanetCount"].Set(new GSSliderConfig(1, 10, 99));
- for (var i = 0; i < 14; i++)
- {
- UI[$"{typeLetter[i]}minPlanetCount"].Set(new GSSliderConfig(0, 1, 99));
- UI[$"{typeLetter[i]}maxPlanetCount"].Set(new GSSliderConfig(1, 10, 99));
- UI[$"{typeLetter[i]}minPlanetSize"].Set(new GSSliderConfig(5, 30, 500));
- UI[$"{typeLetter[i]}maxPlanetSize"].Set(new GSSliderConfig(50, 500, 510));
- }
- }
-
- public void DisableLudicrousMode()
- {
- Config.MaxStarCount = 1024;
- UI["starSizeMulti"].Set(new GSSliderConfig(1f, 10f, 20f));
- UI["minPlanetSize"].Set(new GSSliderConfig(30, 50, 200));
- UI["maxPlanetSize"].Set(new GSSliderConfig(200, 500, 500));
- UI["defaultStarCount"].Set(new GSSliderConfig(1, 64, 1024));
- UI["minPlanetCount"].Set(new GSSliderConfig(0, 1, 25));
- UI["maxPlanetCount"].Set(new GSSliderConfig(1, 10, 25));
- for (var i = 0; i < 14; i++)
- {
- UI[$"{typeLetter[i]}minPlanetCount"].Set(new GSSliderConfig(0, 1, 25));
- UI[$"{typeLetter[i]}maxPlanetCount"].Set(new GSSliderConfig(1, 10, 25));
- UI[$"{typeLetter[i]}minPlanetSize"].Set(new GSSliderConfig(30, 50, 200));
- UI[$"{typeLetter[i]}maxPlanetSize"].Set(new GSSliderConfig(200, 500, 500));
- }
- }
-
- public void EnableSafeMode()
- {
- //GS2.Warn("Enabling SafeMode");
- LockUI("ludicrousMode", false);
- DisableLudicrousMode();
- UI["minPlanetSize"].Set(new GSSliderConfig(100, 100, 200));
- UI["maxPlanetSize"].Set(new GSSliderConfig(200, 300, 400));
- LockUI("birthPlanetSize", 200);
- LockUI("birthPlanetSiTi", false);
- LockUI("birthPlanetUnlock", false);
- LockUI("hugeGasGiants", false);
- LockUI("galaxyDensity", 5);
- UI["defaultStarCount"].Set(new GSSliderConfig(8, 32, 64));
- LockUI("moonsAreSmall", false);
- LockUI("secondarySatellites", false);
- UI["minPlanetCount"].Set(new GSSliderConfig(1, 1, 5));
- UI["maxPlanetCount"].Set(new GSSliderConfig(1, 6, 6));
- for (var i = 0; i < 14; i++)
- {
- LockUI($"{typeLetter[i]}minPlanetCount", 1);
- LockUI($"{typeLetter[i]}maxPlanetCount", 6);
- LockUI($"{typeLetter[i]}minPlanetSize", 100);
- LockUI($"{typeLetter[i]}maxPlanetSize", 400);
- LockUI($"{typeLetter[i]}sizeBias", 50);
- LockUI($"{typeLetter[i]}chanceGas", 50);
- LockUI($"{typeLetter[i]}chanceMoon", 50);
- LockUI($"{typeLetter[i]}systemDensity", 3);
- }
- }
-
- private void LockUI(string key, Val value)
- {
- //GS2.Warn("LockUI " + key +" " + value.ToString());
- UI[key].Set(value);
- UI[key].Disable();
- }
-
- private void UnlockUI(string key)
- {
- UI[key].Enable();
- }
-
- public void DisableSafeMode()
- {
- UI["ludicrousMode"].Enable();
- UI["minPlanetSize"].Set(new GSSliderConfig(30, 50, 200));
- UI["maxPlanetSize"].Set(new GSSliderConfig(50, 500, 500));
- UnlockUI("birthPlanetSize");
- UnlockUI("birthPlanetSiTi");
- UnlockUI("birthPlanetUnlock");
- UnlockUI("hugeGasGiants");
- UnlockUI("galaxyDensity");
- UI["defaultStarCount"].Set(new GSSliderConfig(1, 64, 1024));
- UnlockUI("moonsAreSmall");
- UnlockUI("secondarySatellites");
- UI["minPlanetCount"].Set(new GSSliderConfig(0, 1, 25));
- UI["maxPlanetCount"].Set(new GSSliderConfig(1, 10, 25));
- for (var i = 0; i < 14; i++)
- {
- UnlockUI($"{typeLetter[i]}minPlanetCount");
- UnlockUI($"{typeLetter[i]}maxPlanetCount");
- UnlockUI($"{typeLetter[i]}minPlanetSize");
- UnlockUI($"{typeLetter[i]}maxPlanetSize");
- UnlockUI($"{typeLetter[i]}sizeBias");
- UnlockUI($"{typeLetter[i]}chanceGas");
- UnlockUI($"{typeLetter[i]}chanceMoon");
- UnlockUI($"{typeLetter[i]}systemDensity");
- }
- }
-
- private void DefaultStarCountCallback(Val o)
- {
- Config.DefaultStarCount = preferences.GetInt("defaultStarCount", 64);
- }
-
- private void InitPreferences()
- {
- preferences.Set("safeMode", false);
- preferences.Set("ludicrousMode", false);
- preferences.Set("galaxyDensity", 5);
- preferences.Set("defaultStarCount", 64);
- preferences.Set("starSizeMulti", 10);
- preferences.Set("birthPlanetSize", 200);
- preferences.Set("birthPlanetUnlock", false);
- preferences.Set("birthPlanetSiTi", false);
- preferences.Set("moonsAreSmall", true);
- preferences.Set("hugeGasGiants", true);
- preferences.Set("tidalLockInnerPlanets", false);
- preferences.Set("secondarySatellites", false);
- preferences.Set("minPlanetCount", 1);
- preferences.Set("maxPlanetCount", 10);
- preferences.Set("minPlanetSize", 30);
- preferences.Set("maxPlanetSize", 500);
- preferences.Set("sizeBias", 50);
- preferences.Set("countBias", 50);
- preferences.Set("freqK", 40);
- preferences.Set("freqM", 50);
- preferences.Set("freqG", 30);
- preferences.Set("freqF", 25);
- preferences.Set("freqA", 10);
- preferences.Set("freqB", 4);
- preferences.Set("freqO", 2);
- preferences.Set("freqBH", 1);
- preferences.Set("freqN", 1);
- preferences.Set("freqW", 2);
- preferences.Set("freqRG", 1);
- preferences.Set("freqYG", 1);
- preferences.Set("freqWG", 1);
- preferences.Set("freqBG", 1);
- for (var i = 0; i < 14; i++)
- {
- preferences.Set($"{typeLetter[i]}minPlanetCount", 1);
- preferences.Set($"{typeLetter[i]}maxPlanetCount", 10);
- preferences.Set($"{typeLetter[i]}maxPlanetSize", 500);
- preferences.Set($"{typeLetter[i]}minPlanetSize", 50);
- preferences.Set($"{typeLetter[i]}sizeBias", 50);
- preferences.Set($"{typeLetter[i]}countBias", 50);
- preferences.Set($"{typeLetter[i]}chanceGas", 20);
- preferences.Set($"{typeLetter[i]}chanceMoon", 20);
- preferences.Set($"{typeLetter[i]}systemDensity", 3);
- }
- }
-
- private void AddUIElements()
- {
- UI.Add("safeMode", Options.Add(GSUI.Checkbox("Safe Mode".Translate(), false, "safeMode", o =>
- {
- if ((bool) o) EnableSafeMode();
- else DisableSafeMode();
- })));
- UI.Add("ludicrousMode", Options.Add(GSUI.Checkbox("Ludicrous Mode".Translate(), false, "ludicrousMode", o =>
- {
- if ((bool) o) EnableLudicrousMode();
- else DisableLudicrousMode();
- })));
- UI.Add("galaxyDensity", Options.Add(GSUI.Slider("Galaxy Density".Translate(), 1, 5, 9, "galaxyDensity")));
- UI.Add("defaultStarCount",
- Options.Add(GSUI.Slider("Default StarCount".Translate(), 1, 64, 1024, "defaultStarCount",
- DefaultStarCountCallback)));
- UI.Add("starSizeMulti",
- Options.Add(GSUI.Slider("Star Size Multiplier".Translate(), 1f, 10f, 20f, 0.1f, "starSizeMulti")));
- UI.Add("birthPlanetSize",
- Options.Add(GSUI.PlanetSizeSlider("Starting Planet Size".Translate(), 20, 200, 510, "birthPlanetSize")));
- UI.Add("birthPlanetUnlock",
- Options.Add(GSUI.Checkbox("Starting Planet Unlock".Translate(), false, "birthPlanetUnlock")));
- UI.Add("birthPlanetSiTi", Options.Add(GSUI.Checkbox("Starting planet Si/Ti".Translate(), false, "birthPlanetSiTi")));
- UI.Add("moonsAreSmall", Options.Add(GSUI.Checkbox("Moons Are Small".Translate(), true, "moonsAreSmall")));
- UI.Add("hugeGasGiants", Options.Add(GSUI.Checkbox("Huge Gas Giants".Translate(), true, "hugeGasGiants")));
- UI.Add("tidalLockInnerPlanets",
- Options.Add(GSUI.Checkbox("Tidal Lock Inner Planets".Translate(), false, "tidalLockInnerPlanets")));
- UI.Add("secondarySatellites",
- Options.Add(GSUI.Checkbox("Secondary satellites".Translate(), false, "secondarySatellites")));
-
- UI.Add("freqK", Options.Add(GSUI.Slider("Freq. Type K".Translate(), 0, 40, 100, "freqK")));
- UI.Add("freqM", Options.Add(GSUI.Slider("Freq. Type M".Translate(), 0, 50, 100, "freqM")));
- UI.Add("freqG", Options.Add(GSUI.Slider("Freq. Type G".Translate(), 0, 30, 100, "freqG")));
- UI.Add("freqF", Options.Add(GSUI.Slider("Freq. Type F".Translate(), 0, 25, 100, "freqF")));
- UI.Add("freqA", Options.Add(GSUI.Slider("Freq. Type A".Translate(), 0, 10, 100, "freqA")));
- UI.Add("freqB", Options.Add(GSUI.Slider("Freq. Type B".Translate(), 0, 4, 100, "freqB")));
- UI.Add("freqO", Options.Add(GSUI.Slider("Freq. Type O".Translate(), 0, 2, 100, "freqO")));
- UI.Add("freqBH", Options.Add(GSUI.Slider("Freq. BlackHole".Translate(), 0, 1, 100, "freqBH")));
- UI.Add("freqN", Options.Add(GSUI.Slider("Freq. Neutron".Translate(), 0, 1, 100, "freqN")));
- UI.Add("freqW", Options.Add(GSUI.Slider("Freq. WhiteDwarf".Translate(), 0, 2, 100, "freqW")));
- UI.Add("freqRG", Options.Add(GSUI.Slider("Freq. Red Giant".Translate(), 0, 1, 100, "freqRG")));
- UI.Add("freqYG", Options.Add(GSUI.Slider("Freq. Yellow Giant".Translate(), 0, 1, 100, "freqYG")));
- UI.Add("freqWG", Options.Add(GSUI.Slider("Freq. White Giant".Translate(), 0, 1, 100, "freqWG")));
- UI.Add("freqBG", Options.Add(GSUI.Slider("Freq. Blue Giant".Translate(), 0, 1, 100, "freqBG")));
-
- //options.Add(GSUI.Header("Default Settings", "Changing These Will Reset All Star Specific Options Below"));
- UI.Add("minPlanetCount",
- Options.Add(GSUI.Slider("Min Planets/System".Translate(), 1, 4, 25, "minPlanetCount", MinPlanetCountCallback)));
- UI.Add("maxPlanetCount",
- Options.Add(GSUI.Slider("Max Planets/System".Translate(), 1, 10, 25, "maxPlanetCount", MaxPlanetCountCallback)));
- UI.Add("countBias",
- Options.Add(GSUI.Slider("Planet Count Bias".Translate(), 0, 50, 100, "sizeBias", CountBiasCallback)));
- UI.Add("minPlanetSize",
- Options.Add(GSUI.PlanetSizeSlider("Min planet size".Translate(), 30, 50, 200, "minPlanetSize",
- MinPlanetSizeCallback)));
- UI.Add("maxPlanetSize",
- Options.Add(GSUI.PlanetSizeSlider("Max planet size".Translate(), 200, 500, 500, "maxPlanetSize",
- MaxPlanetSizeCallback)));
- UI.Add("sizeBias", Options.Add(GSUI.Slider("Planet Size Bias".Translate(), 0, 50, 100, "sizeBias", SizeBiasCallback)));
-
- UI.Add("chanceGas", Options.Add(GSUI.Slider("Chance Gas".Translate(), 10, 20, 50, "chanceGas", GasChanceCallback)));
- UI.Add("chanceMoon", Options.Add(GSUI.Slider("Chance Moon".Translate(), 10, 20, 80, "chanceMoon", MoonChanceCallback)));
- UI.Add("systemDensity",
- Options.Add(GSUI.Slider("System Density".Translate(), 1, 3, 5, "systemDensity", SystemDensityCallback)));
-
- for (var i = 0; i < 14; i++)
- {
- //options.Add(GSUI.Header("$Type K Star Override", "Settings for K type stars only"));
- typeCallbacks.Add($"{typeLetter[i]}minPlanetSize", CreateTypeMinPlanetSizeCallback(typeLetter[i]));
- typeCallbacks.Add($"{typeLetter[i]}maxPlanetSize", CreateTypeMaxPlanetSizeCallback(typeLetter[i]));
- UI.Add($"{typeLetter[i]}minPlanetCount",
- Options.Add(GSUI.Slider($"{typeDesc[i]} Min Planets".Translate(), 1, 1, 25, $"{typeLetter[i]}minPlanetCount")));
- UI.Add($"{typeLetter[i]}maxPlanetCount",
- Options.Add(GSUI.Slider($"{typeDesc[i]} Max Planets".Translate(), 1, 10, 25,
- $"{typeLetter[i]}maxPlanetCount")));
- UI.Add($"{typeLetter[i]}countBias",
- Options.Add(GSUI.Slider($"{typeDesc[i]} Count Bias".Translate(), 0, 50, 100, $"{typeLetter[i]}countBias")));
- UI.Add($"{typeLetter[i]}minPlanetSize",
- Options.Add(GSUI.PlanetSizeSlider($"{typeDesc[i]} Min Size".Translate(), 30, 50, 200,
- $"{typeLetter[i]}minPlanetSize", typeCallbacks[$"{typeLetter[i]}minPlanetSize"])));
- UI.Add($"{typeLetter[i]}maxPlanetSize",
- Options.Add(GSUI.PlanetSizeSlider($"{typeDesc[i]} Max Size".Translate(), 200, 500, 500,
- $"{typeLetter[i]}maxPlanetSize", typeCallbacks[$"{typeLetter[i]}maxPlanetSize"])));
- UI.Add($"{typeLetter[i]}sizeBias",
- Options.Add(GSUI.Slider($"{typeDesc[i]} Size Bias".Translate(), 0, 50, 100, $"{typeLetter[i]}sizeBias")));
- UI.Add($"{typeLetter[i]}chanceGas",
- Options.Add(GSUI.Slider($"{typeDesc[i]} %Gas".Translate(), 10, 20, 50, $"{typeLetter[i]}chanceGas")));
- UI.Add($"{typeLetter[i]}chanceMoon",
- Options.Add(GSUI.Slider($"{typeDesc[i]} %Moon".Translate(), 10, 20, 80, $"{typeLetter[i]}chanceMoon")));
- UI.Add($"{typeLetter[i]}systemDensity",
- Options.Add(GSUI.Slider($"{typeDesc[i]} Density".Translate(), 1, 3, 5, $"{typeLetter[i]}systemDensity")));
- }
- }
-
- private GSOptionCallback CreateTypeMinPlanetSizeCallback(string type)
- {
- return o =>
- {
- var maxSize = preferences.GetFloat($"{type}maxPlanetSize");
- if (maxSize == -1f) maxSize = 510;
- if (maxSize < (float) o) o = maxSize;
- if (preferences.GetBool("safeMode")) preferences.Set($"{type}minPlanetSize", SafePlanetSize((float) o));
- else preferences.Set($"{type}minPlanetSize", Utils.ParsePlanetSize((float) o));
- UI[$"{type}minPlanetSize"].Set(preferences.GetFloat($"{type}minPlanetSize"));
- };
- }
-
- private GSOptionCallback CreateTypeMaxPlanetSizeCallback(string type)
- {
- return o =>
- {
- var minSize = preferences.GetFloat($"{type}minPlanetSize");
- if (minSize == -1f) minSize = 5;
- if (minSize > (float) o) o = minSize;
- if (preferences.GetBool("safeMode")) preferences.Set($"{type}maxPlanetSize", SafePlanetSize((float) o));
- else preferences.Set($"{type}maxPlanetSize", Utils.ParsePlanetSize((float) o));
- UI[$"{type}maxPlanetSize"].Set(preferences.GetFloat($"{type}maxPlanetSize"));
- };
- }
-
- private void SizeBiasCallback(Val o)
- {
- SetAllStarTypeOptions("sizeBias", o);
- }
-
- private void CountBiasCallback(Val o)
- {
- SetAllStarTypeOptions("countBias", o);
- }
-
- private void MoonChanceCallback(Val o)
- {
- SetAllStarTypeOptions("chanceMoon", o);
- }
-
- private void GasChanceCallback(Val o)
- {
- SetAllStarTypeOptions("chanceGas", o);
- }
-
- private void SystemDensityCallback(Val o)
- {
- SetAllStarTypeOptions("systemDensity", o);
- }
-
- private void MinPlanetCountCallback(Val o)
- {
- var maxCount = preferences.GetInt("maxPlanetCount");
- if (maxCount == -1f) maxCount = 25;
- if (maxCount < o)
- {
- //GS2.Warn("<");
- o = maxCount;
- preferences.Set("minPlanetCount", maxCount);
- UI["minPlanetCount"].Set(o);
- }
-
- SetAllStarTypeOptions("minPlanetCount", o);
- }
-
- private void MaxPlanetCountCallback(Val o)
- {
- var minCount = preferences.GetInt("minPlanetCount");
- if (minCount == -1f) minCount = 1;
- if (minCount > o)
- {
- //GS2.Warn(">");
- o = minCount;
- preferences.Set("maxPlanetCount", minCount);
- UI["maxPlanetCount"].Set(o);
- }
-
- SetAllStarTypeOptions("maxPlanetCount", o);
- }
-
- private void SetAllStarTypeOptions(string key, Val value)
- {
- for (var i = 0; i < 14; i++) UI[$"{typeLetter[i]}{key}"].Set(value);
- }
-
- private void SetAllStarTypeMinSize(Val value)
- {
- for (var i = 0; i < 14; i++) typeCallbacks[$"{typeLetter[i]}minPlanetSize"](value);
- }
-
- private void SetAllStarTypeMaxSize(Val value)
- {
- for (var i = 0; i < 14; i++) typeCallbacks[$"{typeLetter[i]}maxPlanetSize"](value);
- }
-
- private void MinPlanetSizeCallback(Val o)
- {
- var maxSize = preferences.GetFloat("maxPlanetSize");
- if (maxSize == -1f) maxSize = 510;
- if (maxSize < o) o = maxSize;
- if (preferences.GetBool("safeMode")) preferences.Set("minPlanetSize", SafePlanetSize(o));
- else preferences.Set("minPlanetSize", Utils.ParsePlanetSize(o));
- UI["minPlanetSize"].Set(preferences.GetFloat("minPlanetSize"));
- SetAllStarTypeMinSize(o);
- }
-
- private void MaxPlanetSizeCallback(Val o)
- {
- var t = o;
- var minSize = preferences.GetFloat("minPlanetSize");
- if (minSize == -1f) minSize = 5;
- if (minSize > o) o = minSize;
- if (preferences.GetBool("safeMode")) preferences.Set("maxPlanetSize", SafePlanetSize(o));
- else preferences.Set("maxPlanetSize", Utils.ParsePlanetSize(o));
- UI["maxPlanetSize"].Set(preferences.GetFloat("maxPlanetSize"));
- SetAllStarTypeMaxSize(o);
- }
-
- private float SafePlanetSize(float size)
- {
- if (size > 350) return 400;
- if (size > 250) return 300;
- if (size > 150) return 200;
- return 100;
- }
-
- private Dictionary CalculateFrequencies()
- {
- var StarFreqTupleArray = new (string type, double chance)[14];
- var fK = preferences.GetDouble("freqK", 40);
- var fM = preferences.GetDouble("freqM", 50);
- var fG = preferences.GetDouble("freqG", 30);
- var fF = preferences.GetDouble("freqF", 25);
- var fA = preferences.GetDouble("freqA", 10);
- var fB = preferences.GetDouble("freqB", 4);
- var fO = preferences.GetDouble("freqO", 2);
- var fBH = preferences.GetDouble("freqBH", 1);
- var fN = preferences.GetDouble("freqN", 1);
- var fW = preferences.GetDouble("freqW", 2);
- var fRG = preferences.GetDouble("freqRG", 1);
- var fYG = preferences.GetDouble("freqYG", 1);
- var fWG = preferences.GetDouble("freqWG", 1);
- var fBG = preferences.GetDouble("freqBG", 1);
- var total = fK + fM + fG + fF + fA + fB + fO + fBH + fN + fW + fRG + fYG + fWG + fBG;
- //GS2.Warn($"{total} = {fK} + {fM} + {fG} + {fF} + {fA} + {fB} + {fO} + {fBH} + {fN} + {fW} + {fRG} + {fYG} + {fWG} + {fBG}");
-
- StarFreqTupleArray[0] = ("K", fK / total);
- StarFreqTupleArray[1] = ("M", fM / total);
- StarFreqTupleArray[2] = ("G", fG / total);
- StarFreqTupleArray[3] = ("F", fF / total);
- StarFreqTupleArray[4] = ("A", fA / total);
- StarFreqTupleArray[5] = ("B", fB / total);
- StarFreqTupleArray[6] = ("O", fO / total);
- StarFreqTupleArray[7] = ("BH", fBH / total);
- StarFreqTupleArray[8] = ("N", fN / total);
- StarFreqTupleArray[9] = ("W", fW / total);
- StarFreqTupleArray[10] = ("RG", fRG / total);
- StarFreqTupleArray[11] = ("YG", fYG / total);
- StarFreqTupleArray[12] = ("WG", fWG / total);
- StarFreqTupleArray[13] = ("BG", fBG / total);
- //string[] keys = StarFreq.Keys.ToArray();
- //GS2.LogJson(StarFreqTupleArray, true);
- starFreq = new Dictionary();
- starFreq.Add("K", fK / total);
- for (var i = 1; i < StarFreqTupleArray.Length; i++)
- {
- var element = StarFreqTupleArray[i];
- var previousElement = StarFreqTupleArray[i - 1];
- starFreq.Add(element.type, element.chance + previousElement.chance);
- StarFreqTupleArray[i].chance += previousElement.chance;
- }
- //GS2.LogJson(starFreq, true);
-
- return starFreq;
- }
-
- private (EStarType type, ESpectrType spectr) ChooseStarType()
- {
- var choice = random.NextDouble();
- var starType = "";
- for (var i = 0; i < starFreq.Count; i++)
- if (choice < starFreq.ElementAt(i).Value)
- {
- starType = starFreq.ElementAt(i).Key;
- //GS2.Warn($"Picked Startype {starType} with choice {choice} and value {starFreq.ElementAt(i).Value}");
- break;
- }
-
- switch (starType)
- {
- case "K": return (EStarType.MainSeqStar, ESpectrType.K);
- case "M": return (EStarType.MainSeqStar, ESpectrType.M);
- case "G": return (EStarType.MainSeqStar, ESpectrType.G);
- case "F": return (EStarType.MainSeqStar, ESpectrType.F);
- case "A": return (EStarType.MainSeqStar, ESpectrType.A);
- case "B": return (EStarType.MainSeqStar, ESpectrType.B);
- case "O": return (EStarType.MainSeqStar, ESpectrType.O);
- case "BH": return (EStarType.BlackHole, ESpectrType.X);
- case "N": return (EStarType.NeutronStar, ESpectrType.X);
- case "W": return (EStarType.WhiteDwarf, ESpectrType.X);
- case "RG": return (EStarType.GiantStar, ESpectrType.M);
- case "YG": return (EStarType.GiantStar, ESpectrType.G);
- case "WG": return (EStarType.GiantStar, ESpectrType.A);
- default: return (EStarType.GiantStar, ESpectrType.B);
- }
- }
-
- private int GetMaxPlanetCountForStar(GSStar star)
- {
- var sl = GetTypeLetterFromStar(star);
- return preferences.GetInt($"{sl}maxPlanetCount", preferences.GetInt("maxPlanetCount"));
- }
-
- private int GetMinPlanetCountForStar(GSStar star)
- {
- var sl = GetTypeLetterFromStar(star);
- return preferences.GetInt($"{sl}minPlanetCount", preferences.GetInt("minPlanetCount"));
- }
-
- private int GetMaxPlanetSizeForStar(GSStar star)
- {
- var sl = GetTypeLetterFromStar(star);
- return preferences.GetInt($"{sl}maxPlanetSize", preferences.GetInt("maxPlanetSize"));
- }
-
- private int GetMinPlanetSizeForStar(GSStar star)
- {
- var sl = GetTypeLetterFromStar(star);
- return preferences.GetInt($"{sl}minPlanetSize", preferences.GetInt("minPlanetSize"));
- }
-
- private int GetSizeBiasForStar(GSStar star)
- {
- var sl = GetTypeLetterFromStar(star);
- return preferences.GetInt($"{sl}sizeBias", 50);
- }
-
- private int GetCountBiasForStar(GSStar star)
- {
- var sl = GetTypeLetterFromStar(star);
- return preferences.GetInt($"{sl}countBias", 50);
- }
-
- private int GetSystemDensityForStar(GSStar star)
- {
- var sl = GetTypeLetterFromStar(star);
- return preferences.GetInt($"{sl}systemDensity", 3);
- }
-
- private int GetSystemDensityBiasForStar(GSStar star)
- {
- switch (GetSystemDensityForStar(star))
- {
- case 5: return 90;
- case 4: return 70;
- case 2: return 30;
- case 1: return 10;
- default: return 50;
- }
- }
-
- private double GetMoonChanceForStar(GSStar star)
- {
- var sl = GetTypeLetterFromStar(star);
- return preferences.GetInt($"{sl}chanceMoon", 20) / 100.0;
- }
-
- private double GetGasChanceForStar(GSStar star)
- {
- var sl = GetTypeLetterFromStar(star);
- return preferences.GetInt($"{sl}chanceGas", 20) / 100.0;
- }
- }
-}
\ No newline at end of file
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2/Themes.cs b/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2/Themes.cs
deleted file mode 100644
index 75b30bb9..00000000
--- a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2/Themes.cs
+++ /dev/null
@@ -1,479 +0,0 @@
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace GalacticScale.Generators
-{
- public partial class GS2Generator : iConfigurableGenerator
- {
- public static string[] baseKeys;
-
- public void SetupBaseThemes()
- {
- var newLibrary = new ThemeLibrary();
- foreach (var v in ThemeLibrary.Vanilla())
- {
- var clone = v.Value.Clone();
- //GS2.Log("Adding Theme " + clone.Name + " themeCount:" + newLibrary.Count);
- newLibrary.Add(v.Key, clone);
- }
-
- baseKeys = new string[newLibrary.Keys.Count];
- //GS2.Warn(newLibrary.Count.ToString());
- newLibrary.Keys.CopyTo(baseKeys, 0);
- //foreach (var k in baseKeys) GS2.Log("BaseKey:" +k);
- //foreach (var old in GS2.ThemeLibrary)
- //{
- // GSTheme newTheme = old.Value.Clone();
- // newTheme.Name += "_";
- // GS2.Log($"Cloned {old.Key} to {newTheme.Name}");
- // newTheme.DisplayName = old.Value.DisplayName;
- // newLibrary.Add(newTheme.Name, newTheme );
- //}
- var smolLibrary = new ThemeLibrary();
- var keys = new string[newLibrary.Count + 1];
- newLibrary.Keys.CopyTo(keys, 0);
- for (var i = 0; i < newLibrary.Count; i++)
- {
- var key = keys[i];
- var theme = newLibrary[key];
- if (theme.PlanetType == EPlanetType.Ocean) theme.MinRadius = 50;
- if (theme.PlanetType != EPlanetType.Gas && theme.PlanetType != EPlanetType.Ocean)
- {
- //For rocky worlds
- var smolTheme = theme.Clone();
- smolTheme.DisplayName = theme.DisplayName;
- smolTheme.Name += "smol";
- smolLibrary.Add(smolTheme.Name, smolTheme);
- smolTheme.MaxRadius = 40;
- theme.MinRadius = 50;
- if (theme.PlanetType == EPlanetType.Vocano)
- {
- theme.TerrainSettings.BrightnessFix = true;
- smolTheme.TerrainSettings.BrightnessFix = true;
- theme.Init();
- smolTheme.Init();
- }
-
- smolTheme.atmosphereMaterial.Params["_Intensity"] = 0f;
- //string[] pKeys = new string[100];
- //smolTheme.atmosphereMaterial.Params.Keys.CopyTo(pKeys, 0);
- //for (var j = 0; j < smolTheme.atmosphereMaterial.Colors.Count; j++) smolTheme.atmosphereMaterial.Params[pKeys[j]] = Color.clear;
- }
- }
-
- foreach (var s in smolLibrary)
- if (!newLibrary.ContainsKey(s.Key)) newLibrary.Add(s.Key, s.Value);
- else newLibrary[s.Key] = s.Value;
- GS2.ThemeLibrary = GSSettings.ThemeLibrary = newLibrary;
- }
-
- public static void InitThemes()
- {
- var sulfursea = new GSTheme("SulfurSea", "Sulfurous Sea".Translate(), "OceanWorld");
- var giganticforest = new GSTheme("GiganticForest", "Gigantic Forest".Translate(), "OceanicJungle");
- var moltenworld = new GSTheme("MoltenWorld", "Molten World".Translate(), "Lava");
- var redforest = new GSTheme("RedForest", "Red Forest".Translate(), "OceanicJungle");
- var beach = new GSTheme("Beach", "Beach".Translate(), "OceanWorld");
- beach.VeinSettings = new GSVeinSettings
- {
- Algorithm = "GS2",
- VeinPadding = 1f,
- VeinTypes = new GSVeinTypes
- {
- GSVeinType.Generate(EVeinType.Silicium, 10, 30, 1f, 10f, 5, 25, false),
- GSVeinType.Generate(EVeinType.Bamboo, 2, 6, 1, 10f, 5, 25, true),
- GSVeinType.Generate(EVeinType.Fractal, 2, 6, 1, 10f, 5, 25, false),
- GSVeinType.Generate(EVeinType.Grat, 2, 6, 1, 10f, 5, 25, false)
- }
- };
- beach.VegeSettings = Themes.Mediterranean.VegeSettings.Clone();
- beach.VegeSettings.Group1.Clear();
- beach.VegeSettings.Group2.Clear();
- beach.VegeSettings.Group4 = beach.VegeSettings.Group3;
- beach.TerrainSettings.Algorithm = "GSTA1";
- beach.CustomGeneration = true;
- //GS2.LogJson(beach, true);
- giganticforest.VegeSettings.Group1.Clear();
- giganticforest.VegeSettings.Group2.Clear();
- giganticforest.VegeSettings.Group3.Clear();
- giganticforest.VegeSettings.Group4.Clear();
- giganticforest.VegeSettings.Group5.Clear();
- giganticforest.VegeSettings.Group6.Clear();
- giganticforest.Vegetables1 = new[]
- {
- 42, 42, 42, 46, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 103, 103, 103, 103, 103,
- 103, 104, 104, 104, 104, 104, 104, 125, 125, 125, 125, 125, 125, 601, 601, 601, 601, 601, 601, 602, 602,
- 602, 602, 602, 602, 603, 603, 603, 603, 603, 603, 604, 604, 604, 604, 604, 604, 605, 605, 605, 605, 605,
- 605
- }; // Medium density, Biome border only
- giganticforest.Vegetables2 =
- new[] {1001, 1002, 1003, 1005, 1006, 1007}; // Dense clumped ground scatter, everywhere
- giganticforest.Vegetables3 =
- new[] {43, 46, 47, 47, 101, 102, 103, 104, 106, 601, 602, 604}; // Sparse, lowland only
- giganticforest.Vegetables4 = new int[] { }; // Unused
- giganticforest.Vegetables5 = new[]
- {
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 46, 46, 47, 47, 47, 47, 47, 47, 47,
- 102, 103, 103, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 125, 125,
- 125, 125, 125, 125, 125, 604, 604, 604, 604, 604, 604, 604, 605, 605, 605, 605, 605, 605, 605, 1001,
- 1001, 1001, 1001, 1001, 1001, 1001, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002
- }; // Dense, Highland only
- giganticforest.PopulateVegeData();
- giganticforest.Distribute = EThemeDistribute.Default;
- giganticforest.Habitable = true;
- giganticforest.CustomGeneration = true;
- giganticforest.TerrainSettings.Algorithm = "GSTA6";
- Themes.Mediterranean.InitMaterials();
- Themes.OceanicJungle.InitMaterials();
- giganticforest.oceanMat = Themes.Mediterranean.oceanMat;
-
- //moltenworld.IonHeight = Themes.OceanicJungle.IonHeight;
- moltenworld.CustomGeneration = true;
- moltenworld.TerrainSettings = new GSTerrainSettings
- {
- Algorithm = "GSTA1",
- BaseHeight = -1.5, //negative numbers lower the ocean
- xFactor = 0.01,
- yFactor = 0.012,
- zFactor = 0.01,
- HeightMulti = 0.4, //how exagerated the ups and downs are
- LandModifier = -0.9, //how clumpy the land is
- RandomFactor = -1,
- BiomeHeightMulti = 2.0,
- BiomeHeightModifier = 1.2
- };
- moltenworld.MinRadius = 20;
- moltenworld.MaxRadius = 510;
- moltenworld.ThemeType = EThemeType.Telluric;
- redforest.VegeSettings.Group1.Clear();
- redforest.VegeSettings.Group2.Clear();
- redforest.VegeSettings.Group3.Clear();
- redforest.VegeSettings.Group4.Clear();
- redforest.VegeSettings.Group5.Clear();
- redforest.VegeSettings.Group6.Clear();
- redforest.Vegetables0 = new[] {26, 26, 45, 603, 604}; // lowlands
- redforest.Vegetables1 = new[] {1001, 1001, 1001, 1001, 1001, 1001, 45, 26, 26}; // Ground scatter, highlands
- redforest.Vegetables2 = new[] {1001}; // Grass ground scatter, highlands
- redforest.Vegetables3 = new[] {26, 26, 26, 26, 45, 602, 603, 604}; // Ground
- redforest.Vegetables4 = new[] {1001, 26, 602, 603, 604}; // Semi clumped shoreline
- redforest.Vegetables5 = new[] {25, 32, 36, 37, 39, 41}; // Water
- redforest.PopulateVegeData();
- redforest.VeinCount = Themes.RedStone.VeinCount;
- redforest.VeinSpot = Themes.RedStone.VeinSpot;
- redforest.VeinOpacity = Themes.RedStone.VeinOpacity;
- redforest.RareSettings = Themes.RedStone.RareSettings;
- redforest.RareVeins = Themes.RedStone.RareVeins;
- redforest.CustomGeneration = true;
- redforest.TerrainSettings = new GSTerrainSettings
- {
- Algorithm = "GSTA1",
- BaseHeight = -0.7,
- xFactor = 0.01,
- yFactor = 0.012,
- zFactor = 0.01,
- HeightMulti = 1.2,
- LandModifier = 1.3,
- RandomFactor = 0.3,
- BiomeHeightMulti = 2.0,
- BiomeHeightModifier = 0.2
- };
-
- redforest.terrainMaterial.Tint = new Color(.1f, 0.6f, 0.05f, 1f);
-
- sulfursea.CustomGeneration = true;
- sulfursea.Habitable = false;
- sulfursea.MinRadius = 20;
- sulfursea.MaxRadius = 510;
- sulfursea.Temperature = 1;
- sulfursea.TerrainSettings = new GSTerrainSettings
- {
- Algorithm = "GSTA1",
- HeightMulti = 1,
- BaseHeight = -1.3,
- LandModifier = -0.7,
- RandomFactor = 0.1,
- BiomeHeightMulti = 2.9,
- BiomeHeightModifier = 1
- };
- sulfursea.ThemeType = EThemeType.Telluric;
- sulfursea.AmbientSettings = Themes.VolcanicAsh.AmbientSettings.Clone();
- sulfursea.VegeSettings.Group1.Clear();
- sulfursea.VegeSettings.Group2.Clear();
- sulfursea.VegeSettings.Group3.Clear();
- sulfursea.VegeSettings.Group4.Clear();
- sulfursea.VegeSettings.Group5.Clear();
- sulfursea.VegeSettings.Group6.Clear();
- sulfursea.Vegetables0 = new int[] { }; // lowlands
- sulfursea.Vegetables1 = new int[] { }; // Ground scatter, highlands
- sulfursea.Vegetables2 = new int[] { }; // Grass ground scatter, highlands
- sulfursea.Vegetables3 = new[] {601, 602, 603, 604, 605}; // Ground
- sulfursea.Vegetables4 = new[] {601, 602, 603, 604, 605}; // Semi clumped shoreline
- sulfursea.Vegetables5 = new int[] { }; // Water
- sulfursea.terrainMaterial.CopyFrom = "Gobi.terrainMat";
- sulfursea.atmosphereMaterial.CopyFrom = "VolcanicAsh.atmosMat";
- //sulfursea.oceanMat = Themes.Mediterranean.oceanMat;
- sulfursea.oceanMaterial.Colors.Clear();
- foreach (var c in Themes.VolcanicAsh.oceanMaterial.Colors)
- sulfursea.oceanMaterial.Colors.Add(c.Key, c.Value);
- sulfursea.atmosphereMaterial.Tint = new Color(0.3f, 0.3f, 0f, 1f);
- sulfursea.oceanMaterial.Params["_GIGloss"] = 1;
- sulfursea.oceanMaterial.Params["_GISaturate"] = 0.8f;
- sulfursea.oceanMaterial.Params["_GIStrengthDay"] = 1;
- sulfursea.oceanMaterial.Params["_GIStrengthNight"] = 0.0f;
- sulfursea.terrainMaterial.Tint = new Color(.8f, .7f, .6f, 1f);
- sulfursea.thumbMaterial.CopyFrom = "Gobi.thumbMat";
- sulfursea.minimapMaterial.CopyFrom = "Gobi.minimapMat";
- sulfursea.WaterItemId = 1116;
- sulfursea.Process();
- giganticforest.Process();
- moltenworld.Process();
- redforest.Process();
- beach.Process();
-
- //GS2.Log("Creating Themes");
- var oiler = new GSTheme("OilGiant", "SpaceWhale Excrement".Translate(), "IceGiant");
- oiler.terrainMaterial.Tint = new Color(0.3f, 0.3f, 0.3f, 1f);
- oiler.atmosphereMaterial.Tint = new Color(0f, 0f, 0f, 1);
- oiler.thumbMaterial.Tint = new Color(0.01f, 0.005f, 0f, 0.001f);
- oiler.PlanetType = EPlanetType.Gas;
- oiler.TerrainSettings.Algorithm = "GSTA1";
- oiler.TerrainSettings.HeightMulti = 1.4;
- oiler.CustomGeneration = true;
- oiler.GasItems[0] = 1114;
- oiler.GasItems[1] = 1120;
- oiler.GasSpeeds[0] = 0.1f;
- oiler.GasSpeeds[1] = 10f;
- oiler.ThemeType = EThemeType.Private;
- oiler.Process();
- //GS2.Log("Oiler Processed");
-
- var obsidian = new GSTheme("Obsidian", "Obsidian".Translate(), "IceGelisol");
- obsidian.terrainMaterial.Tint = new Color(0.05f, 0.05f, 0.05f, 1);
- obsidian.oceanMaterial.Tint = new Color(0.0f, 0.0f, 0.0f, 0.5f);
- obsidian.atmosphereMaterial.Tint = Color.black;
- obsidian.TerrainSettings.Algorithm = "GSTA3";
- obsidian.TerrainSettings.BiomeHeightMulti = -10f;
- obsidian.CustomGeneration = true;
- obsidian.AmbientSettings.CubeMap = "GS2";
- obsidian.terrainMat.SetFloat("_HeightEmissionRadius", 0f);
- obsidian.terrainMat.SetFloat("_EmissionStrength", 0f);
- obsidian.terrainMat.SetFloat("_NormalStrength", 0.3f);
- obsidian.terrainMat.SetFloat("_Distance", 0f);
- obsidian.Temperature = 2f;
- obsidian.Process();
-
- var hotObsidian = new GSTheme("HotObsidian", "Hot Obsidian".Translate(), "Obsidian");
- hotObsidian.MaxRadius = 40;
- hotObsidian.MinRadius = 5;
- hotObsidian.terrainMaterial.Tint = new Color(0.2f, 0.05f, 0.05f, 1);
- hotObsidian.Temperature = 5f;
- hotObsidian.atmosphereMaterial.Tint = Color.clear;
- hotObsidian.Process();
-
- //GS2.Log("About to Process redIce");
- var iceMalusol = new GSTheme("IceMalusol", "Ice Malusol".Translate(), "IceGelisol");
- iceMalusol.terrainMaterial.Textures.Add("_BioTex0A", "GS2|red-ice");
- iceMalusol.terrainMaterial.Textures.Add("_BioTex1A", "GS2|grey-rock");
- iceMalusol.terrainMaterial.Textures.Add("_BioTex2A", "GS2|grey-snow");
- iceMalusol.AmbientSettings.Reflections = new Color(1, 0, 0, 1);
- iceMalusol.AmbientSettings.CubeMap = "GS2";
- iceMalusol.Process();
-
- var acidGreenhouse = new GSTheme("AcidGreenhouse", "Acid Greenhouse".Translate(), "VolcanicAsh");
- acidGreenhouse.atmosphereMaterial.Tint = new Color(0.5f, 0.4f, 0.0f, 0.8f);
- acidGreenhouse.atmosphereMaterial.Params = new Dictionary
- {
- ["_AtmoDensity"] = 1,
- ["_Cutoff"] = 0.1f,
- ["_FarFogDensity"] = 1f,
- ["_FogDensity"] = 1f,
- ["_FogSaturate"] = 1.8f,
- ["_Intensity"] = 1.8f,
- ["_Parallax"] = 0.02f,
- ["_RimFogExp"] = 1.3f,
- ["_RimFogPower"] = 3f,
- ["_SkyAtmosPower"] = 17f,
- ["_SunColorAdd"] = 40f,
- ["_SunColorSkyUse"] = 0.4f,
- ["_SunColorUse"] = 0.2f,
- ["_SunRiseScatterPower"] = 160f
- };
- acidGreenhouse.oceanMaterial.Tint = new Color(0.7f, 0.7f, 0.07f);
- acidGreenhouse.terrainMaterial.Tint = new Color(0.901f, 0.686f, 0.098f, 1);
- acidGreenhouse.thumbMaterial.Tint = new Color(0.901f, 0.686f, 0.098f, 1);
- acidGreenhouse.minimapMaterial.Tint = new Color(0.901f, 0.686f, 0.098f, 1);
- acidGreenhouse.terrainMaterial.CopyFrom = "AshenGelisol.terrainMat";
- acidGreenhouse.terrainMaterial.Colors = new Dictionary
- {
- ["_AmbientColor0"] = new Color(0.9f, 0.9f, 0.1f, 1f),
- ["_AmbientColor0"] = new Color(0.8f, 0.8f, 0.7f, 1f),
- ["_AmbientColor0"] = new Color(0.5f, 0.5f, 0.0f, 1f),
- ["_Color"] = new Color(0.65f, 0.5f, 0.15f, 1f)
- };
- acidGreenhouse.terrainMaterial.Params = new Dictionary
- {
- ["_AmbientInc"] = 0.5f
- };
- acidGreenhouse.AmbientSettings.DustStrength1 = 10;
- acidGreenhouse.AmbientSettings.DustStrength2 = 10;
- acidGreenhouse.AmbientSettings.DustStrength3 = 10;
- acidGreenhouse.AmbientSettings.DustColor1 =
- new Color(0.95f, 0.75f, 0.25f, 1f); //new Color(0.38f, 0.38f, 0f, 1f);
- acidGreenhouse.AmbientSettings.DustColor2 = new Color(0.95f, 0.75f, 0.25f, 1f);
- acidGreenhouse.AmbientSettings.DustColor3 = new Color(0.9f, 0.7f, 0.2f, 1f);
- acidGreenhouse.AmbientSettings.LutContribution = 0.8f;
- acidGreenhouse.CustomGeneration = true;
- acidGreenhouse.TerrainSettings.BrightnessFix = true;
- acidGreenhouse.TerrainSettings.Algorithm = "GSTA3";
- acidGreenhouse.TerrainSettings.LandModifier = 1;
- acidGreenhouse.TerrainSettings.HeightMulti = 2;
- acidGreenhouse.VeinSettings.VeinTypes = new GSVeinTypes
- {
- GSVeinType.Generate(EVeinType.Iron, 1, 10, 0.5f, 1.5f, 5, 15, false),
- GSVeinType.Generate(EVeinType.Stone, 1, 10, 0.5f, 1.5f, 5, 15, false),
- GSVeinType.Generate(EVeinType.Copper, 1, 20, 0.5f, 1.5f, 5, 15, true),
- GSVeinType.Generate(EVeinType.Silicium, 1, 20, 0.9f, 2.5f, 5, 25, false),
- GSVeinType.Generate(EVeinType.Diamond, 1, 20, 0.5f, 1.5f, 5, 15, true),
- GSVeinType.Generate(EVeinType.Fractal, 1, 20, 0.5f, 1.5f, 5, 15, true)
- };
- acidGreenhouse.VeinSettings.Algorithm = "GS2";
- acidGreenhouse.CustomGeneration = true;
- acidGreenhouse.MinRadius = 150;
- acidGreenhouse.Temperature = 3f;
- acidGreenhouse.ThemeType = EThemeType.Planet;
- acidGreenhouse.Process();
-
- var barrenSatellite = new GSTheme("BarrenSatellite", "Barren Satellite".Translate(), "Barren");
- barrenSatellite.VegeSettings.Group1 = new List
- {
- "Stone1", "Stone2", "Stone3", "Stone4", "Stone5", "Stone6", "Stone7", "Stone8", "Stone9", "Stone10",
- "Stone11", "Stone12", "Stone1", "Stone2", "Stone3", "Stone4", "Stone5", "Stone6", "Stone7", "Stone8",
- "Stone9", "Stone10", "Stone11", "Stone12"
- };
- barrenSatellite.VegeSettings.Group2 = barrenSatellite.VegeSettings.Group1;
- barrenSatellite.VegeSettings.Group3 = barrenSatellite.VegeSettings.Group1;
- barrenSatellite.VegeSettings.Group4 = barrenSatellite.VegeSettings.Group1;
- barrenSatellite.VegeSettings.Group5 = barrenSatellite.VegeSettings.Group1;
- barrenSatellite.VegeSettings.Group6 = barrenSatellite.VegeSettings.Group1;
- barrenSatellite.atmosphereMaterial.Params = new Dictionary {["_AtmoDensity"] = 0f};
- barrenSatellite.VeinSettings.VeinTypes = new GSVeinTypes
- {
- GSVeinType.Generate(EVeinType.Titanium, 1, 10, 0.2f, 1.5f, 5, 15, false),
- GSVeinType.Generate(EVeinType.Stone, 1, 100, 0.5f, 1.5f, 5, 35, false),
- //GSVeinType.Generate(EVeinType.Copper, 1, 10, 0.5f, 1.5f, 5, 15, false ),
- //GSVeinType.Generate(EVeinType.Silicium, 1, 10, 0.5f, 1.5f, 5, 15, false ),
- GSVeinType.Generate(EVeinType.Grat, 1, 10, 0.5f, 1.5f, 5, 15, true)
- };
- barrenSatellite.VeinSettings.Algorithm = "GS2";
- barrenSatellite.CustomGeneration = true;
- barrenSatellite.ThemeType = EThemeType.Moon;
- barrenSatellite.atmosphereMaterial.Params["_Intensity"] = 0f;
- barrenSatellite.Process();
-
- var dwarf = new GSTheme("DwarfPlanet", "Dwarf Planet".Translate(), "Barren");
- dwarf.Algo = 3;
- dwarf.CustomGeneration = true;
- dwarf.Temperature = 0;
- dwarf.Distribute = EThemeDistribute.Default;
- dwarf.TerrainSettings = new GSTerrainSettings
- {
- RandomFactor = 10,
- LandModifier = .1f,
- Algorithm = "GSTA3"
- };
- dwarf.VeinSettings = new GSVeinSettings
- {
- Algorithm = "GS2",
- VeinPadding = 0.5f,
- VeinTypes = new GSVeinTypes
- {
- GSVeinType.Generate(EVeinType.Iron, 1, 10, 0.5f, 1.5f, 5, 15, false),
- GSVeinType.Generate(EVeinType.Stone, 1, 10, 0.5f, 1.5f, 5, 15, false),
- GSVeinType.Generate(EVeinType.Copper, 1, 10, 0.5f, 1.5f, 5, 15, false),
- GSVeinType.Generate(EVeinType.Silicium, 1, 10, 0.5f, 1.5f, 5, 15, false),
- GSVeinType.Generate(EVeinType.Fireice, 1, 10, 0.5f, 1.5f, 5, 15, true)
- }
- };
- dwarf.Wind = 0f;
- dwarf.ThemeType = EThemeType.Planet;
- dwarf.Process();
-
- var center = new GSTheme("Center", " ", "Barren");
- center.PlanetType = EPlanetType.Gas;
- center.atmosphereMaterial.Tint = Color.black;
- center.thumbMaterial.Tint = Color.black;
- center.ThemeType = EThemeType.Private;
- center.Process();
-
- var hotGas = new GSTheme("Inferno", "Infernal Gas Giant".Translate(), "GasGiant");
- hotGas.terrainMaterial.Tint = new Color(1, 0.8f, 0.1f);
- hotGas.Temperature = 4f;
- hotGas.MinRadius = 5;
- hotGas.MaxRadius = 510;
- hotGas.ThemeType = EThemeType.Gas;
-
-
- //hotGas.atmosMat = y;
- //GS2.Log("Creating oceanmat");
- hotGas.oceanMaterial.CopyFrom = "GasGiant.terrainMat";
- //hotGas.oceanMat.SetColor("_Color1", new Color() { r = 0.866f, g = 0.407f, b = 0.172f, a = 1 });
- //hotGas.oceanMat.SetColor("_Color2", new Color() { r = 0.717f, g = 0.349f, b = 0.164f, a = 1 });
- //hotGas.oceanMat.SetColor("_Color", new Color() { r = 0.288f, g = 0.14f, b = 0.03f, a = 1 });
- hotGas.oceanMaterial.Colors["_Color"] = new Color {r = 0.288f, g = 0.14f, b = 0.03f, a = 1};
- //hotGas.oceanMat.SetColor("_Color", new Color() { r = 0.917f, g = 0.776f, b = 0.6f, a = 1 });
- hotGas.CustomGeneration = true;
- hotGas.TerrainSettings = new GSTerrainSettings
- {
- Algorithm = "GSTA00"
- };
- hotGas.terrainMaterial.Path = "Universe/Materials/Stars/star-mass-m";
-
- hotGas.terrainMaterial.Colors = new Dictionary
- {
- ["_Color4"] = new Color {r = 0.0f, g = 0.0f, b = 0.0f, a = 1}, //Highlights?
- ["_Color1"] = new Color {r = 0f, g = 0, b = 0f, a = 1}, //Base?
- ["_Color2"] = new Color {r = 0, g = 0f, b = 0, a = 1}, //SunSpots
- ["_Color3"] = new Color {r = 0, g = 0, b = 0f, a = 1}
- }; //Fringe
- hotGas.terrainMaterial.Params = new Dictionary
- {
- ["_SkyAtmosPower"] = 10,
- ["_Intensity"] = 0.5f,
- ["_Multiplier"] = 0.5f,
- ["_AtmoThickness"] = 3
- };
- hotGas.WaterItemId = 1000;
- hotGas.Process();
-
- //hotGas.Process();
- //var x = Resources.FindObjectsOfTypeAll();
- //foreach (var y in x)
- //{
- // if (y.name == "star-mass-m")
- // {
- // //hotGas.atmosMat = y;
- // hotGas.oceanMat = hotGas.terrainMat;
- // //hotGas.oceanMat.SetColor("_Color1", new Color() { r = 0.866f, g = 0.407f, b = 0.172f, a = 1 });
- // //hotGas.oceanMat.SetColor("_Color2", new Color() { r = 0.717f, g = 0.349f, b = 0.164f, a = 1 });
- // hotGas.oceanMat.SetColor("_Color", new Color() { r = 0.288f, g = 0.14f, b = 0.03f, a = 1 });
- // //hotGas.oceanMat.SetColor("_Color", new Color() { r = 0.917f, g = 0.776f, b = 0.6f, a = 1 });
- // hotGas.CustomGeneration = true;
- // hotGas.TerrainSettings = new GSTerrainSettings()
- // {
- // Algorithm = "GSTA00",
- // };
- // hotGas.terrainMat = Object.Instantiate(y);
- // hotGas.terrainMat.SetColor("_Color4", new Color() { r = 0.0f, g = 0.0f, b = 0.0f, a = 1 });//Highlights?
- // hotGas.terrainMat.SetColor("_Color1", new Color() { r = 0f, g = 0, b = 0f, a = 1 });//Base?
- // hotGas.terrainMat.SetColor("_Color2", new Color() { r = 0, g = 0f, b = 0, a = 1 });//SunSpots
- // hotGas.terrainMat.SetColor("_Color3", new Color() { r = 0, g = 0, b = 0f, a = 1 });//Fringe
- // hotGas.terrainMat.SetFloat("_SkyAtmosPower", 10);
- // hotGas.terrainMat.SetFloat("_Intensity", 0.5f);
- // hotGas.terrainMat.SetFloat("_Multiplier", 0.5f);
- // hotGas.terrainMat.SetFloat("_AtmoThickness", 3);
- // hotGas.WaterItemId = 1000;
- // }
- //}
- }
- }
-}
\ No newline at end of file
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/GS2Generator.cs b/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/GS2Generator.cs
index 291978e6..6bdc8f10 100644
--- a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/GS2Generator.cs
+++ b/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/GS2Generator.cs
@@ -169,7 +169,7 @@ private void EnsureBirthSystemHasTi()
GSSettings.ThemeLibrary.Add("AshenGelisol", Themes.AshenGelisol);
Themes.AshenGelisol.Process();
}
- GS2.Warn($"Ashen Gelisol:{GSSettings.ThemeLibrary.ContainsKey("AshenGelisol")}");
+ // GS2.Warn($"Ashen Gelisol:{GSSettings.ThemeLibrary.ContainsKey("AshenGelisol")}");
// }
var tiPlanet = birthPlanet.Moons.Add(new GSPlanet("Titania McGrath", "AshenGelisol",
GetStarPlanetSize(birthStar), 0.03f, 66f, 900f, 0f,
@@ -390,8 +390,10 @@ private int ClampedNormalSize(GS2.Random random, int min, int max, int bias)
private void AddSiTiToBirthPlanet()
{
Warn("Setting SI/TI");
+ birthPlanet.veinSettings = birthPlanet.GsTheme.VeinSettings.Clone();
birthPlanet.veinSettings.Algorithm = "GS2";
birthPlanet.GsTheme.CustomGeneration = true;
+ // Warn("2");
birthPlanet.veinSettings.VeinTypes.Add(GSVeinType.Generate(
EVeinType.Silicium,
1, 10, 0.6f, 0.6f, 5, 10, false));
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/Planets.cs b/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/Planets.cs
index ed234ea6..742fc83e 100644
--- a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/Planets.cs
+++ b/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/Planets.cs
@@ -38,16 +38,16 @@ private void GeneratePlanetsForStar(GSStar star)
var gasCount = Mathf.RoundToInt(starBodyCount * (float)gasChance);
var telluricCount = starBodyCount - gasCount;
- GS2.Log($"GasCount:{gasCount} TelluricCount:{telluricCount}");
+ // GS2.Log($"GasCount:{gasCount} TelluricCount:{telluricCount}");
if (telluricCount == 0 && star == birthStar)
{
telluricCount = 1;
gasCount--;
}
var moonCount = Mathf.RoundToInt(telluricCount * (float)moonChance);
- GS2.Log($"GasCount:{gasCount} TelluricCount:{telluricCount} MoonCount:{moonCount}");
+ // GS2.Log($"GasCount:{gasCount} TelluricCount:{telluricCount} MoonCount:{moonCount}");
telluricCount = telluricCount - moonCount;
- GS2.Log($"GasCount:{gasCount} TelluricCount:{telluricCount} MoonCount:{moonCount}");
+ // GS2.Log($"GasCount:{gasCount} TelluricCount:{telluricCount} MoonCount:{moonCount}");
if (telluricCount == 0 && star == birthStar)
{
@@ -61,12 +61,12 @@ private void GeneratePlanetsForStar(GSStar star)
else telluricCount++;
if (moonCount > 0) moonCount--;
}
- GS2.Log($"GasCount:{gasCount} TelluricCount:{telluricCount} MoonCount:{moonCount}");
+ // GS2.Log($"GasCount:{gasCount} TelluricCount:{telluricCount} MoonCount:{moonCount}");
var secondaryMoonCount = Mathf.RoundToInt((moonCount -1) * (float)subMoonChance);
moonCount -= secondaryMoonCount;
- GS2.Log($"GasCount:{gasCount} TelluricCount:{telluricCount} MoonCount:{moonCount} SecondaryMoonCount:{secondaryMoonCount}");
- GS2.Log($"GasChance:{gasChance} TelluricChance:{1-gasChance} MoonChance:{moonChance} SecondaryMoonChance:{subMoonChance}");
+ // GS2.Log($"GasCount:{gasCount} TelluricCount:{telluricCount} MoonCount:{moonCount} SecondaryMoonCount:{secondaryMoonCount}");
+ // GS2.Log($"GasChance:{gasChance} TelluricChance:{1-gasChance} MoonChance:{moonChance} SecondaryMoonChance:{subMoonChance}");
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/Settings.cs b/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/Settings.cs
index d27960bf..3a61bd60 100644
--- a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/Settings.cs
+++ b/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/Settings.cs
@@ -117,48 +117,48 @@ private string GetGiantStarTypeLetter(ESpectrType spectr)
- private void LockUI(string key, Val value)
- {
- GS2.Warn($"Start {key}");
- if (UI.ContainsKey(key)) UI[key].Set(value);
- GS2.Warn("#");
- if (UI.ContainsKey(key)) UI[key].Disable();
- GS2.Warn("##");
- }
-
- private void UnlockUI(string key)
- {
- UI[key].Enable();
- }
-
- public void DisableSafeMode()
- {
- Log("Disabling SafeMode");
- // UI["ludicrousMode"].Enable();
- // UI["minPlanetSize"].Set(new GSSliderConfig(30, 50, 200));
- // UI["maxPlanetSize"].Set(new GSSliderConfig(50, 500, 500));
- // UnlockUI("birthPlanetSize");
- // UnlockUI("birthPlanetSiTi");
- // UnlockUI("birthPlanetUnlock");
- // UnlockUI("hugeGasGiants");
- // UnlockUI("galaxyDensity");
- // UI["defaultStarCount"].Set(new GSSliderConfig(1, 64, 1024));
- // UnlockUI("moonsAreSmall");
- // UnlockUI("secondarySatellites");
- // UI["minPlanetCount"].Set(new GSSliderConfig(0, 1, 25));
- // UI["maxPlanetCount"].Set(new GSSliderConfig(1, 10, 25));
- // for (var i = 0; i < 14; i++)
- // {
- // UnlockUI($"{typeLetter[i]}minPlanetCount");
- // UnlockUI($"{typeLetter[i]}maxPlanetCount");
- // UnlockUI($"{typeLetter[i]}minPlanetSize");
- // UnlockUI($"{typeLetter[i]}maxPlanetSize");
- // UnlockUI($"{typeLetter[i]}sizeBias");
- // UnlockUI($"{typeLetter[i]}chanceGas");
- // UnlockUI($"{typeLetter[i]}chanceMoon");
- // UnlockUI($"{typeLetter[i]}systemDensity");
- // }
- }
+ // private void LockUI(string key, Val value)
+ // {
+ // GS2.Warn($"Start {key}");
+ // if (UI.ContainsKey(key)) UI[key].Set(value);
+ // GS2.Warn("#");
+ // if (UI.ContainsKey(key)) UI[key].Disable();
+ // GS2.Warn("##");
+ // }
+
+ // private void UnlockUI(string key)
+ // {
+ // UI[key].Enable();
+ // }
+
+ // public void DisableSafeMode()
+ // {
+ // Log("Disabling SafeMode");
+ // // UI["ludicrousMode"].Enable();
+ // // UI["minPlanetSize"].Set(new GSSliderConfig(30, 50, 200));
+ // // UI["maxPlanetSize"].Set(new GSSliderConfig(50, 500, 500));
+ // // UnlockUI("birthPlanetSize");
+ // // UnlockUI("birthPlanetSiTi");
+ // // UnlockUI("birthPlanetUnlock");
+ // // UnlockUI("hugeGasGiants");
+ // // UnlockUI("galaxyDensity");
+ // // UI["defaultStarCount"].Set(new GSSliderConfig(1, 64, 1024));
+ // // UnlockUI("moonsAreSmall");
+ // // UnlockUI("secondarySatellites");
+ // // UI["minPlanetCount"].Set(new GSSliderConfig(0, 1, 25));
+ // // UI["maxPlanetCount"].Set(new GSSliderConfig(1, 10, 25));
+ // // for (var i = 0; i < 14; i++)
+ // // {
+ // // UnlockUI($"{typeLetter[i]}minPlanetCount");
+ // // UnlockUI($"{typeLetter[i]}maxPlanetCount");
+ // // UnlockUI($"{typeLetter[i]}minPlanetSize");
+ // // UnlockUI($"{typeLetter[i]}maxPlanetSize");
+ // // UnlockUI($"{typeLetter[i]}sizeBias");
+ // // UnlockUI($"{typeLetter[i]}chanceGas");
+ // // UnlockUI($"{typeLetter[i]}chanceMoon");
+ // // UnlockUI($"{typeLetter[i]}systemDensity");
+ // // }
+ // }
private void DefaultStarCountCallback(Val o)
{
@@ -206,8 +206,8 @@ private void InitPreferences()
preferences.Set("birthPlanetStar", 14);
preferences.Set("rotationMulti", 1f);
preferences.Set("innerPlanetDistance", 1f);
- preferences.Set("safeMode", false);
- preferences.Set("ludicrousMode", false);
+ // preferences.Set("safeMode", false);
+ // preferences.Set("ludicrousMode", false);
preferences.Set("allowResonances", true);
preferences.Set("galaxyDensity", 5);
preferences.Set("defaultStarCount", 64);
@@ -320,7 +320,7 @@ private void AddUIElements()
UI.Add("birthPlanetStar", bOptions.Add(GSUI.Combobox("BirthPlanet Star".Translate(), starTypes, 7, "birthStar",null, "Type of Star to Start at".Translate())));
Options.Add(GSUI.Group("Birth Planet Settings".Translate(), bOptions, "Settings that only affect the starting planet".Translate()));
UI.Add("moonsAreSmall", Options.Add(GSUI.Checkbox("Moons Are Small".Translate(), true, "moonsAreSmall", null, "Try to ensure moons are 1/2 their planets size or less".Translate())));
- UI.Add("moonBias", Options.Add(GSUI.Slider("Gas Giants Moon Bias".Translate(), 0, 50, 100, "moonBias", null, "Lower prefers telluric plants, higher gas giants".Translate())));
+ UI.Add("moonBias", Options.Add(GSUI.Slider("Gas Giants Moon Bias".Translate(), 0, 50, 100, "moonBias", null, "Lower prefers telluric planets, higher gas giants".Translate())));
UI.Add("hugeGasGiants", Options.Add(GSUI.Checkbox("Huge Gas Giants".Translate(), true, "hugeGasGiants", null,"Allow gas giants larger than 800 radius".Translate())));
UI.Add("tidalLockInnerPlanets",
Options.Add(GSUI.Checkbox("Tidal Lock Inner Planets".Translate(), false, "tidalLockInnerPlanets")));
@@ -405,46 +405,46 @@ private void AddUIElements()
}
private void orbitLowCallback(Val o)
{
- Warn(o);
+ // Warn(o);
SetAllStarTypeRSMin("orbits", o);
}
private void orbitHighCallback(Val o)
{
- GS2.Warn(o);
+ // GS2.Warn(o);
SetAllStarTypeRSMax("orbits", o);
}
private void hzLowCallback(Val o)
{
- Warn(o);
+ // Warn(o);
SetAllStarTypeRSMin("hz", o);
}
private void hzHighCallback(Val o)
{
- GS2.Warn(o);
+ // GS2.Warn(o);
SetAllStarTypeRSMax("hz", o);
}
private void planetCountLow(Val o)
{
- Warn(o);
+ // Warn(o);
SetAllStarTypeRSMin("planetCount", o);
}
private void planetCountHigh(Val o)
{
- GS2.Warn(o);
+ // GS2.Warn(o);
SetAllStarTypeRSMax("planetCount", o);
}
private void planetSizeLow(Val o)
{
- Warn(o);
+ // Warn(o);
SetAllStarTypeRSMin("planetSize", Utils.ParsePlanetSize(o));
}
private void planetSizeHigh(Val o)
{
- GS2.Warn(o);
+ // GS2.Warn(o);
SetAllStarTypeRSMax("planetSize", Utils.ParsePlanetSize(o));
}
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/Stars.cs b/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/Stars.cs
index 9a99b5d2..dfd46b4c 100644
--- a/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/Stars.cs
+++ b/GalacticScale2/Scripts/GalacticScale2.0/Generators/GS2Dev/Stars.cs
@@ -83,7 +83,7 @@ private int GetStarMoonSize(GSStar star, int hostRadius, bool hostGas)
var range = max - min;
var sd = (float) range / 4;
//int size = Utils.ParsePlanetSize(random.Next(min, max));
- var size = Mathf.Clamp(ClampedNormalSize(new GS2.Random(star.Seed), min, max, GetSizeBiasForStar(star)), min, GetMaxPlanetSizeForStar(star));
+ var size = Mathf.Clamp(ClampedNormalSize(random, min, max, GetSizeBiasForStar(star)), min, GetMaxPlanetSizeForStar(star));
//if (size > hostRadius)
//{
//Warn($"MoonSize {size} selected for {star.Name} moon with host size {hostRadius} avg:{average} sd:{sd} max:{max} min:{min} range:{range} hostGas:{hostGas}");
@@ -96,12 +96,14 @@ private int GetStarPlanetSize(GSStar star)
var min = GetMinPlanetSizeForStar(star);
var max = GetMaxPlanetSizeForStar(star);
var bias = GetSizeBiasForStar(star);
- return ClampedNormalSize(new GS2.Random(star.Seed), min, max, bias);
+ return ClampedNormalSize(random, min, max, bias);
}
private (float min, float max) CalculateHabitableZone(GSStar star)
{
var lum = star.luminosity;
var (min, max) = Utils.CalculateHabitableZone(lum);
+ min += star.RadiusAU;
+ max += star.RadiusAU;
var sl = GetTypeLetterFromStar(star);
if (preferences.GetBool($"{sl}hzOverride")) (min, max) = preferences.GetFloatFloat($"{sl}hz", (0,2));
star.genData.Set("minHZ", min);
@@ -133,14 +135,14 @@ private float CalculateMaximumOrbit(GSStar star)
var lum = star.luminosity;
var hzMax = star.genData.Get("maxHZ");
var maxOrbitByLuminosity = lum * 4f;
- var maxOrbitByRadius = Mathf.Sqrt(star.radius);
+ var maxOrbitByRadius = Mathf.Pow(star.radius, 0.75f);
var maxOrbitByHabitableZone = 2f * hzMax;
var maxByPlanetCount = star.bodyCount * 0.3f;
// float density = (2f*GetSystemDensityBiasForStar(star))/100f;
// GS2.Warn($"Density:{density} MaxOrbit:{star.MaxOrbit}");
var max = Mathf.Clamp(Mathf.Max(maxByPlanetCount, minMaxOrbit, maxOrbitByLuminosity, maxOrbitByRadius, maxOrbitByHabitableZone), star.genData.Get("minOrbit")*2f, star.MaxOrbit);
if (preferences.GetBool($"{sl}orbitOverride")) (_, max) = preferences.GetFloatFloat($"{sl}orbits", (0.02f,20f));
- // Warn($"Getting Max Orbit for Star {star.Name} MaxbyRadius({star.radius}):{maxOrbitByRadius} MaxbyPlanets({star.PlanetCount}):{maxByPlanetCount} MaxbyLum({lum}):{maxOrbitByLuminosity} MaxByHZ({hzMax}):{maxOrbitByHabitableZone} Max({max}):{max} HabitableZone:{star.genData.Get("minHZ")}:{hzMax}");
+ // Warn($"Getting Max Orbit for Star {star.Name} HardCap:{star.MaxOrbit} MaxbyRadius({star.radius}):{maxOrbitByRadius} MaxbyPlanets({star.PlanetCount}):{maxByPlanetCount} MaxbyLum({lum}):{maxOrbitByLuminosity} MaxByHZ({hzMax}):{maxOrbitByHabitableZone} Max({max}):{max} HabitableZone:{star.genData.Get("minHZ")}:{hzMax}");
star.genData.Set("maxOrbit", max);
return max;
}
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/IO/Save_Load.cs b/GalacticScale2/Scripts/GalacticScale2.0/IO/Save_Load.cs
index 375d35df..cf8aaba0 100644
--- a/GalacticScale2/Scripts/GalacticScale2.0/IO/Save_Load.cs
+++ b/GalacticScale2/Scripts/GalacticScale2.0/IO/Save_Load.cs
@@ -19,22 +19,50 @@ public static void Export(BinaryWriter w) // Export Settings to Save Game
Log("End");
}
- public static void Import(BinaryReader r) // Load Settings from Save Game
+ public static bool Import(BinaryReader r) // Load Settings from Save Game
{
Log("Importing from Save");
GSSettings.Reset(0);
var serializer = new fsSerializer();
+ GS2.Warn($"Peek:{r.PeekChar()}");
+ GS2.Warn($"{r.BaseStream.Position} / {r.BaseStream.Length}");
+ var position = r.BaseStream.Position;
var version = r.ReadString();
var json = r.ReadString();
File.WriteAllText(DataDir + "\\save.json", json);
var result = GSSettings.Instance;
- var data2 = fsJsonParser.Parse(json);
- serializer.TryDeserialize(data2, ref result);
+ fsData data2;
+ var parseResult = fsJsonParser.Parse(json, out data2);
+
+ if (parseResult.Failed)
+ {
+ GS2.Warn("Parse Failed");
+ r.BaseStream.Position = position;
+ GS2.ActiveGenerator = GetGeneratorByID("space.customizing.generators.vanilla");
+ return false;
+ }
+ var deserialize = serializer.TryDeserialize(data2, ref result);
+ if (deserialize.Failed)
+ {
+ GS2.Warn("Deserialize Failed");
+ r.BaseStream.Position = position;
+ GS2.ActiveGenerator = GetGeneratorByID("space.customizing.generators.vanilla");
+ return false;
+ }
+ GS2.WarnJson(version);
if (version != GSSettings.Instance.version)
+ {
Warn("Version mismatch: " + GSSettings.Instance.version + " trying to load " + version + " savedata");
+ r.BaseStream.Position = position;
+ GS2.ActiveGenerator = GetGeneratorByID("space.customizing.generators.vanilla");
+ return false;
+ }
+ if (Vanilla) ActiveGenerator = GetGeneratorByID("space.customizing.generators.gs2dev");
GSSettings.Instance = result;
GSSettings.Instance.imported = true;
+ GS2.Warn($"{ActiveGenerator.GUID}");
Log("End");
+ return true;
}
}
}
\ No newline at end of file
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/Patches/GameDesc/Export.cs b/GalacticScale2/Scripts/GalacticScale2.0/Patches/GameDesc/Export.cs
index b8994ee6..d549e00d 100644
--- a/GalacticScale2/Scripts/GalacticScale2.0/Patches/GameDesc/Export.cs
+++ b/GalacticScale2/Scripts/GalacticScale2.0/Patches/GameDesc/Export.cs
@@ -9,7 +9,7 @@ public static partial class PatchOnGameDesc
[HarmonyPatch(typeof(GameDesc), "Export")]
public static void Export(BinaryWriter w)
{
- if (GS2.IsMenuDemo) return;
+ if (GS2.IsMenuDemo || GS2.Vanilla) return;
GS2.Export(w);
}
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/Patches/UniverseGen/CreateGalaxy.cs b/GalacticScale2/Scripts/GalacticScale2.0/Patches/UniverseGen/CreateGalaxy.cs
index fe6c77a2..9cdcae03 100644
--- a/GalacticScale2/Scripts/GalacticScale2.0/Patches/UniverseGen/CreateGalaxy.cs
+++ b/GalacticScale2/Scripts/GalacticScale2.0/Patches/UniverseGen/CreateGalaxy.cs
@@ -10,6 +10,7 @@ public partial class PatchOnUniverseGen
public static bool CreateGalaxy(GameDesc gameDesc, ref GalaxyData __result, ref List ___tmp_poses)
{
GS2.gameDesc = gameDesc;
+ GS2.LogJson(gameDesc);
if (DSPGame.IsMenuDemo) return true;
if (GS2.Vanilla) return true;
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/Planet Generation/CreatePlanet.cs b/GalacticScale2/Scripts/GalacticScale2.0/Planet Generation/CreatePlanet.cs
index 50d416e5..f01ad5e2 100644
--- a/GalacticScale2/Scripts/GalacticScale2.0/Planet Generation/CreatePlanet.cs
+++ b/GalacticScale2/Scripts/GalacticScale2.0/Planet Generation/CreatePlanet.cs
@@ -45,7 +45,8 @@ public static PlanetData CreatePlanet(ref StarData star, GSPlanet gsPlanet, Rand
planet.number = index + 1;
planet.id = star.id * 100 + index + 1;
- gsPlanets.Add(planet.id, gsPlanet);
+ if (!gsPlanets.ContainsKey(planet.id)) gsPlanets.Add(planet.id, gsPlanet);
+ else gsPlanets[planet.id] = gsPlanet;
// Log("Setting Roman");
var roman = "";
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MainSettings.cs b/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MainSettings.cs
index 3179bbe5..caae5389 100644
--- a/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MainSettings.cs
+++ b/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MainSettings.cs
@@ -65,6 +65,7 @@ public void Import(GSGenPreferences preferences)
var id = Preferences.GetString("Generator ID", "space.customizing.generators.vanilla");
GS2.ActiveGenerator = GS2.GetGeneratorByID(id);
Preferences.Set("Generator", _generatorNames.IndexOf(GS2.ActiveGenerator.Name));
+ if (!filenames.Contains(Preferences.GetString("Import Filename", null))) Preferences.Set("Import Filename", filenames[0]);
}
public void Init()
@@ -74,7 +75,7 @@ public void Init()
// GS2.LogJson(_generatorNames, true);
_generatorsCombobox = Options.Add(GSUI.Combobox("Generator".Translate(), _generatorNames, 0, "Generator",
GeneratorCallback, "Try them all!".Translate()));
-
+ RefreshFileNames();
Options.Add(GSUI.Checkbox("Skip Prologue".Translate(), false, "Skip Prologue"));
Options.Add(GSUI.Checkbox("Skip Tutorials".Translate(), false, "Skip Tutorials"));
@@ -90,7 +91,11 @@ public void Init()
JsonOptions.Add(GSUI.Input("Export Filename".Translate(), "My First Custom Galaxy", "Export Filename", null, "Excluding .json".Translate()));
JsonOptions.Add(GSUI.Checkbox("Minify Exported JSON".Translate(), false, "Minify JSON", null, "Only save changes".Translate()));
_exportButton = JsonOptions.Add(GSUI.Button("Export Custom Galaxy".Translate(), "Export".Translate(), ExportJsonGalaxy, null, "Save Galaxy to File".Translate()));
- Options.Add(GSUI.Group("Custom Galaxy Export".Translate(), JsonOptions, "Usable once in game".Translate()));
+ JsonOptions.Add(GSUI.Button("Load Custom Galaxy".Translate(), "Load", LoadJsonGalaxy, null,
+ "Will end current game".Translate()));
+ JsonGalaxies = JsonOptions.Add(GSUI.Combobox("Custom Galaxy".Translate(), filenames, CustomFileSelectorCallback, CustomFileSelectorPostfix));
+
+ Options.Add(GSUI.Group("Custom Galaxy Export/Import".Translate(), JsonOptions, "Export available once in game".Translate()));
}
public void SetResourceMultiplier(float val)
@@ -215,6 +220,14 @@ private void ExportAllThemes(Val o)
private static void GeneratorCallback(Val result)
{
+ if (GameMain.isPaused)
+ {
+ UIMessageBox.Show("Error".Translate(),
+ "You cannot change the generator while in game."
+ .Translate(),
+ "Of course not!".Translate(), 2);
+ return;
+ }
// GS2.Warn($"Generator Callback:{(int)result}");
GS2.ActiveGenerator = GS2.Generators[(int)result];
// GS2.Warn("Active Generator = " + GS2.ActiveGenerator.Name);
@@ -273,5 +286,60 @@ public void SetUseExternalThemes(bool val)
{
Preferences.Set("Use External Themes", val);
}
+
+ public void LoadJsonGalaxy(Val o)
+ {
+ var ImportFilename = Preferences.GetString("Import Filename", null);
+ if (string.IsNullOrEmpty(ImportFilename))
+ {
+ UIMessageBox.Show("Error", "To use the Custom JSON Generator you must select a file to load.", "Ok", 1);
+ RefreshFileNames();
+ }
+
+ var path = Path.Combine(Path.Combine(GS2.DataDir, "CustomGalaxies"), ImportFilename + ".json");
+ GS2.LoadSettingsFromJson(path);
+ GS2.Log("Generator:Json|Generate|End");
+ GSSettings.Instance.imported = true;
+ // GS2.gameDesc.playerProto = 2;
+ GS2.gsStars.Clear();
+ GS2.gsPlanets.Clear();
+ // GS2.galaxy = new GalaxyData();
+ var gameDesc = new GameDesc();
+ gameDesc.SetForNewGame(UniverseGen.algoVersion, 1, 1, 1, 1f);
+ if (GS2.Config.SkipPrologue) DSPGame.StartGameSkipPrologue(gameDesc);
+ else DSPGame.StartGame(gameDesc);
+ // UniverseGen.CreateGalaxy(GS2.gameDesc);
+
+ }
+ public List filenames = new List();
+ public void RefreshFileNames()
+ {
+ //GS2.Log("Refreshing Filenames");
+ var customGalaxiesPath = Path.Combine(GS2.DataDir, "CustomGalaxies");
+ if (!Directory.Exists(customGalaxiesPath)) Directory.CreateDirectory(customGalaxiesPath);
+
+ filenames = new List(Directory.GetFiles(customGalaxiesPath, "*.json")).ConvertAll(Path.GetFileNameWithoutExtension);
+ if (filenames.Count == 0)
+ filenames.Add("No Files Found"); //foreach (string n in filenames) GS2.Log("File:" + n);
+ if (JsonGalaxies != null) JsonGalaxies.RectTransform.GetComponentInChildren().Items = filenames;
+ }
+ private void CustomFileSelectorCallback(Val result)
+ {
+ int index = result;
+ if (index > filenames.Count - 1) index = 0;
+ Preferences.Set("Import Filename", filenames[index]);
+ if (Preferences.GetString("Import Filename", null) == "No Files Found") Preferences.Set("Import Filename", "");
+ RefreshFileNames();
+ }
+ private void CustomFileSelectorPostfix()
+ {
+ GS2.Log("Json:Postfix");
+ var index = 0;
+ for (var i = 0; i < filenames.Count; i++)
+ if (Preferences.GetString("Import Filename", null) == filenames[i])
+ index = i;
+ JsonGalaxies.RectTransform.GetComponentInChildren().Value = index;
+ }
+ public GSUI JsonGalaxies;
}
}
\ No newline at end of file
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MonoBehaviors/GSUISelector.cs b/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MonoBehaviors/GSUISelector.cs
new file mode 100644
index 00000000..3e275f7c
--- /dev/null
+++ b/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MonoBehaviors/GSUISelector.cs
@@ -0,0 +1,96 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Steamworks;
+using UnityEngine;
+using UnityEngine.Experimental.PlayerLoop;
+using UnityEngine.UI;
+
+namespace GalacticScale
+{
+ public class GSUISelector : MonoBehaviour
+ {
+ public Button lbutton;
+ public Button rButton;
+ public GSOptionCallback OnLeftClick;
+ public GSOptionCallback OnRightClick;
+ public GSOptionCallback OnChange;
+ public Text _labelText;
+ public Text _hintText;
+ public Text _itemText;
+ public List Items = new List() {"Test", "Test2", "test3!"};
+ private int _index = 0;
+ public int index
+ {
+ get
+ {
+ return _index;
+ }
+ set
+ {
+ _index = value;
+ UpdateItem();
+ }
+ }
+
+ public string value
+ {
+ get
+ {
+ return Items[_index];
+ }
+ set
+ {
+ if (!Items.Contains(value)) GS2.Error($"Trying to set an invalid value of {value}");
+ else _index = Items.IndexOf(value);
+ UpdateItem();
+ }
+ }
+
+ public void UpdateItem()
+ {
+ if (Items.Count == 0) return;
+ if (_index < 0 || _index >= Items.Count) index = 0;
+ _itemText.text = Items[_index];
+ }
+ public string Hint
+ {
+ get => _hintText.text;
+ set => _hintText.text = value;
+ }
+ public string Label
+ {
+ get => _labelText.text;
+ set => _labelText.text = value;
+ }
+
+
+ public void LeftClick()
+ {
+ Debug.Log("LeftClick");
+ _index--;
+ if (_index < 0) _index = Items.Count - 1;
+ UpdateItem();
+ }
+ public void RightClick()
+ {
+ Debug.Log("LeftClick");
+ _index--;
+ if (_index > Items.Count -1) _index = 0;
+ UpdateItem();
+ }
+ public void initialize(GSUI options)
+ {
+ // GS2.Log("Initializing");
+ //_dropdown.AddOptions(options.Data as List);
+ // Caption = (string)options.Data;
+ Canvas.ForceUpdateCanvases();
+ Label = options.Label;
+ Hint = options.Hint;
+ OnChange = options.callback;
+ //options.postfix?.Invoke();
+
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MonoBehaviors/GSUITemplates.cs b/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MonoBehaviors/GSUITemplates.cs
index 511a35e4..a2903c5c 100644
--- a/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MonoBehaviors/GSUITemplates.cs
+++ b/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MonoBehaviors/GSUITemplates.cs
@@ -14,10 +14,12 @@ public class GSUITemplates : MonoBehaviour
public GSUITemplate slider;
public GSUITemplate dropdown;
public GSUITemplate header;
+ public GSUITemplate togglelist;
public GSUITemplate spacer;
public GSUITemplate separator;
public GSUITemplate toggle;
public GSUITemplate input;
+ public GSUITemplate selector;
}
}
\ No newline at end of file
diff --git a/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MonoBehaviors/GSUIToggleList.cs b/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MonoBehaviors/GSUIToggleList.cs
new file mode 100644
index 00000000..b4c2054a
--- /dev/null
+++ b/GalacticScale2/Scripts/GalacticScale2.0/SettingsUI/MonoBehaviors/GSUIToggleList.cs
@@ -0,0 +1,171 @@
+using System;
+using System.Collections.Generic;
+
+using UnityEngine;
+using UnityEngine.UI;
+using UnityEngine.UI.Extensions;
+
+namespace GalacticScale
+{
+ public class GSUIToggleList : MonoBehaviour
+ {
+ public GameObject List;
+ public List Contents;
+ public GameObject ListHeading;
+ public GameObject ListCollapseButton;
+ public GameObject ListExpandButton;
+ public GameObject ListContents;
+ public GSUITemplates templates;
+ public bool Collapsible = false;
+ public bool ShowHeader = true;
+ public Text _labelText;
+ public Text _hintText;
+ public Toggle toggle;
+ public bool interactable
+ {
+ get
+ {
+ return ListCollapseButton.GetComponent