diff --git a/SEWorldGenPlugin/GUI/PluginWorldSettings.cs b/SEWorldGenPlugin/GUI/PluginWorldSettings.cs index 91b8ad1..4301b16 100644 --- a/SEWorldGenPlugin/GUI/PluginWorldSettings.cs +++ b/SEWorldGenPlugin/GUI/PluginWorldSettings.cs @@ -140,6 +140,9 @@ protected override void BuildControls() PlSettings.GeneratorSettings.PlanetSettings.Moons = MySettings.Static.Settings.GeneratorSettings.PlanetSettings.Moons; PlSettings.GeneratorSettings.PlanetSettings.MandatoryPlanets = MySettings.Static.Settings.GeneratorSettings.PlanetSettings.MandatoryPlanets; PlSettings.GeneratorSettings.PlanetSettings.GasGiants = MySettings.Static.Settings.GeneratorSettings.PlanetSettings.GasGiants; + //PlSettings.GeneratorSettings.PlanetSettings.PlanetNameFormat = MySettings.Static.Settings.GeneratorSettings.PlanetSettings.PlanetNameFormat; + //PlSettings.GeneratorSettings.PlanetSettings.MoonNameFormat = MySettings.Static.Settings.GeneratorSettings.PlanetSettings.MoonNameFormat; + //PlSettings.GeneratorSettings.BeltSettings.BeltNameFormat = MySettings.Static.Settings.GeneratorSettings.BeltSettings.BeltNameFormat; } else { diff --git a/SEWorldGenPlugin/Generator/SystemGenerator.cs b/SEWorldGenPlugin/Generator/SystemGenerator.cs index 818209a..813e694 100644 --- a/SEWorldGenPlugin/Generator/SystemGenerator.cs +++ b/SEWorldGenPlugin/Generator/SystemGenerator.cs @@ -235,7 +235,12 @@ private void GeneratePlanet(int index, long distance, int totalObjects, ref int var height = MyRandom.Instance.GetRandomFloat((float)Math.PI / 180 * -5, (float)Math.PI / 180 * 5); Vector3D pos = new Vector3D(distance * Math.Sin(angle), distance * Math.Cos(angle), distance * Math.Sin(height)); - planet.DisplayName = "Planet " + (++planetIndex); + string name = SettingsSession.Static.Settings.GeneratorSettings.PlanetSettings.PlanetNameFormat + .SetProperty("ObjectNumber", ++planetIndex) + .SetProperty("ObjectNumberGreek", greek_letters[planetIndex]) + .SetProperty("ObjectId", def.Id.SubtypeId.String); + + planet.DisplayName = name; planet.Type = SystemObjectType.PLANET; planet.DefName = def.Id.SubtypeId.String; planet.Size = size; @@ -264,12 +269,17 @@ private MyPlanetMoonItem[] GenerateMoons(float planetSize, float surfaceGravity, if (dist + distance > m_settings.WorldSize && m_settings.WorldSize > 0) return moons; + string name = SettingsSession.Static.Settings.GeneratorSettings.PlanetSettings.PlanetNameFormat + .SetProperty("ObjectNumber", i) + .SetProperty("ObjectNumberGreek", greek_letters[i]) + .SetProperty("ObjectId", def.Id.SubtypeId.String); + MyPlanetMoonItem item = new MyPlanetMoonItem(); item.Type = SystemObjectType.MOON; item.DefName = def.Id.SubtypeName.ToString(); item.Distance = dist; item.Size = SizeByGravity(def.SurfaceGravity, isGasGiant); - item.DisplayName = planetName + " " + (char)('A' + i); + item.DisplayName = name; moons[i] = item; } diff --git a/SEWorldGenPlugin/ObjectBuilders/MyObjectBuilder_PluginSettings.cs b/SEWorldGenPlugin/ObjectBuilders/MyObjectBuilder_PluginSettings.cs index 2b8a9c8..1162153 100644 --- a/SEWorldGenPlugin/ObjectBuilders/MyObjectBuilder_PluginSettings.cs +++ b/SEWorldGenPlugin/ObjectBuilders/MyObjectBuilder_PluginSettings.cs @@ -10,7 +10,15 @@ public class MyObjectBuilder_PluginSettings public MyObjectBuilder_PluginSettings() { Enable = false; - GeneratorSettings = new GeneratorSettings(); + if(MySettings.Static != null) + if(MySettings.Static.Settings != null) + { + GeneratorSettings = MySettings.Static.Settings.GeneratorSettings.copy(); + } + else + { + GeneratorSettings = new GeneratorSettings(); + } } [ProtoMember(1)] @@ -19,6 +27,14 @@ public MyObjectBuilder_PluginSettings() [ProtoMember(2)] public GeneratorSettings GeneratorSettings; + public MyObjectBuilder_PluginSettings copy() + { + MyObjectBuilder_PluginSettings s = new MyObjectBuilder_PluginSettings(); + s.Enable = Enable; + s.GeneratorSettings = GeneratorSettings.copy(); + return s; + } + public void Verify() { GeneratorSettings.Verify(); @@ -89,6 +105,27 @@ public GeneratorSettings() [ProtoMember(13)] public bool MoonsOnlyOnce; + public GeneratorSettings copy() + { + GeneratorSettings g = new GeneratorSettings(); + g.MinObjectsInSystem = MinObjectsInSystem; + g.MaxObjectsInSystem = MaxObjectsInSystem; + g.MinOrbitDistance = MinOrbitDistance; + g.MaxOrbitDistance = MaxOrbitDistance; + g.AsteroidGenerator = AsteroidGenerator; + g.AsteroidDensity = AsteroidDensity; + g.PlanetSettings = PlanetSettings.copy(); + g.BeltSettings = BeltSettings.copy(); + g.SemiRandomizedGeneration = SemiRandomizedGeneration; + g.WorldSize = WorldSize; + g.FirstPlanetCenter = FirstPlanetCenter; + g.UseVanillaPlanets = UseVanillaPlanets; + g.PlanetsOnlyOnce = PlanetsOnlyOnce; + g.MoonsOnlyOnce = MoonsOnlyOnce; + + return g; + } + public void Verify() { Verifier.VerifyInt(0, MaxObjectsInSystem, 5, "MinObjectsInSystem", ref MinObjectsInSystem); @@ -116,6 +153,8 @@ public PlanetSettings() ShowMoonGPS = false; BlacklistedPlanets = new HashSet(); BlacklistedPlanets.Add("MoonTutorial"); + PlanetNameFormat = "Planet [ObjectNumber]"; + MoonNameFormat = "Moon [ObjectNumber]"; MandatoryPlanets = new HashSet(); @@ -143,17 +182,42 @@ public PlanetSettings() public bool ShowMoonGPS; [ProtoMember(7)] - public HashSet BlacklistedPlanets; + public string PlanetNameFormat; [ProtoMember(8)] - public HashSet MandatoryPlanets; + public string MoonNameFormat; [ProtoMember(9)] - public HashSet Moons; + public HashSet BlacklistedPlanets; [ProtoMember(10)] + public HashSet MandatoryPlanets; + + [ProtoMember(11)] + public HashSet Moons; + + [ProtoMember(12)] public HashSet GasGiants; + public PlanetSettings copy() + { + PlanetSettings p = new PlanetSettings(); + p.SizeMultiplier = SizeMultiplier; + p.PlanetSizeCap = PlanetSizeCap; + p.MoonProbability = MoonProbability; + p.RingSettings = RingSettings.copy(); + p.ShowPlanetGPS = ShowPlanetGPS; + p.ShowMoonGPS = ShowMoonGPS; + p.PlanetNameFormat = PlanetNameFormat; + p.MoonNameFormat = MoonNameFormat; + p.BlacklistedPlanets = BlacklistedPlanets; + p.MandatoryPlanets = MandatoryPlanets; + p.Moons = Moons; + p.GasGiants = GasGiants; + + return p; + } + public void Verify() { Verifier.VerifyFloat(0, float.MaxValue, 2, "PlanetSettings.SizeMultiplier", ref SizeMultiplier); @@ -187,6 +251,16 @@ public PlanetRingSettings() [ProtoMember(4)] public bool ShowRingGPS; + public PlanetRingSettings copy() + { + PlanetRingSettings r = new PlanetRingSettings(); + r.MinPlanetRingWidth = MinPlanetRingWidth; + r.MaxPlanetRingWidth = MaxPlanetRingWidth; + r.PlanetRingProbability = PlanetRingProbability; + r.ShowRingGPS = ShowRingGPS; + + return r; + } public void Verify() { @@ -205,6 +279,7 @@ public BeltSettings() MaxBeltHeight = 40000; BeltProbability = 0.2f; ShowBeltGPS = true; + BeltNameFormat = "Belt [ObjectNumberGreek]"; } [ProtoMember(1)] @@ -219,6 +294,20 @@ public BeltSettings() [ProtoMember(4)] public bool ShowBeltGPS; + [ProtoMember(5)] + public string BeltNameFormat; + + public BeltSettings copy() + { + BeltSettings b = new BeltSettings(); + b.MinBeltHeight = MinBeltHeight; + b.MaxBeltHeight = MaxBeltHeight; + b.BeltProbability = BeltProbability; + b.ShowBeltGPS = ShowBeltGPS; + b.BeltNameFormat = BeltNameFormat; + return b; + } + public void Verify() { Verifier.VerifyInt(0, MaxBeltHeight, 4000, "BeltSettings.MinBeltHeight", ref MinBeltHeight); diff --git a/SEWorldGenPlugin/Properties/AssemblyInfo.cs b/SEWorldGenPlugin/Properties/AssemblyInfo.cs index dbbd5e2..c371392 100644 --- a/SEWorldGenPlugin/Properties/AssemblyInfo.cs +++ b/SEWorldGenPlugin/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.7.5.0")] +[assembly: AssemblyVersion("1.7.6.0")] [assembly: AssemblyFileVersion("1.0.0")] diff --git a/SEWorldGenPlugin/SEWorldGenPlugin.csproj b/SEWorldGenPlugin/SEWorldGenPlugin.csproj index bf9c188..3f11f4d 100644 --- a/SEWorldGenPlugin/SEWorldGenPlugin.csproj +++ b/SEWorldGenPlugin/SEWorldGenPlugin.csproj @@ -210,6 +210,7 @@ + diff --git a/SEWorldGenPlugin/Utilities/StringExtension.cs b/SEWorldGenPlugin/Utilities/StringExtension.cs new file mode 100644 index 0000000..3aa600f --- /dev/null +++ b/SEWorldGenPlugin/Utilities/StringExtension.cs @@ -0,0 +1,12 @@ + +namespace SEWorldGenPlugin.Utilities +{ + static class StringExtension + { + + public static string SetProperty(this string s, string propertyName, T value) + { + return s.Replace("[" + propertyName + "]", value.ToString()); + } + } +}