public void Reset() { this.seedString = GenText.RandomSeedString(); this.planetCoverage = (float)((Prefs.DevMode && UnityData.isEditor) ? 0.05000000074505806 : 0.30000001192092896); this.rainfall = OverallRainfall.Normal; this.temperature = OverallTemperature.Normal; }
public static SimpleCurve GetTemperatureCurve(this OverallTemperature overallTemperature) { switch (overallTemperature) { case OverallTemperature.VeryCold: return(OverallTemperatureUtility.Curve_VeryCold); case OverallTemperature.Cold: return(OverallTemperatureUtility.Curve_Cold); case OverallTemperature.LittleBitColder: return(OverallTemperatureUtility.Curve_LittleBitColder); case OverallTemperature.LittleBitWarmer: return(OverallTemperatureUtility.Curve_LittleBitWarmer); case OverallTemperature.Hot: return(OverallTemperatureUtility.Curve_Hot); case OverallTemperature.VeryHot: return(OverallTemperatureUtility.Curve_VeryHot); default: return(null); } }
public void Reset() { this.seedString = GenText.RandomSeedString(); this.planetCoverage = ((Prefs.DevMode && UnityData.isEditor) ? 0.05f : 0.3f); this.rainfall = OverallRainfall.Normal; this.temperature = OverallTemperature.Normal; }
public void Reset() { seedString = GenText.RandomSeedString(); planetCoverage = ((!Prefs.DevMode || !UnityData.isEditor) ? 0.3f : 0.05f); rainfall = OverallRainfall.Normal; temperature = OverallTemperature.Normal; population = OverallPopulation.Normal; }
public void Reset() { _seedString = GenText.RandomSeedString(); _planetCoverage = Prefs.DevMode && UnityData.isEditor ? 0.05f : 0.3f; _intCoverage = Prefs.DevMode && UnityData.isEditor ? 5 : 30; _rainfall = OverallRainfall.Normal; _temperature = OverallTemperature.Normal; }
public WorldPreset(string name, WorldType worldType, AxialTilt axialTilt, RainfallModifier rainfallModifier, OverallTemperature temperature, OverallPopulation population) { Name = name ?? throw new ArgumentNullException(nameof(name)); WorldType = worldType; AxialTilt = axialTilt; RainfallModifier = rainfallModifier; Temperature = temperature; Population = population; }
public PagePreciseWorldGeneration(float planetCoverage, string seedString, OverallRainfall rainFall, OverallTemperature temperature, OverallPopulation population, Dictionary <FactionDef, int> factionCounts) { _planetCoverage = planetCoverage; _seedString = seedString; _rainfall = rainFall; _temperature = temperature; _population = population; _factionCounts = factionCounts; }
public override void DoWindowContents(Rect rect) { DrawPageTitle(rect); GUI.BeginGroup(GetMainRect(rect)); Text.Font = GameFont.Small; var num = 0f; Widgets.Label(new Rect(0f, num, 200f, 30f), "WorldSeed".Translate()); var rect2 = new Rect(200f, num, 200f, 30f); _seedString = Widgets.TextField(rect2, _seedString); num += 40f; var rect3 = new Rect(200f, num, 200f, 30f); if (Widgets.ButtonText(rect3, "RandomizeSeed".Translate())) { SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(); _seedString = GenText.RandomSeedString(); } num += 40f; Text.Font = GameFont.Tiny; var textAnchorBackup = Text.Anchor; Text.Anchor = TextAnchor.MiddleCenter; Widgets.Label(new Rect(0, num, rect3.xMax, 20f), "[Prepare Landing] Precise World Generation %"); Text.Font = GameFont.Small; Text.Anchor = textAnchorBackup; num += 20f; Widgets.Label(new Rect(0f, num, 200f, 30f), $"{"PlanetCoverage".Translate()} [1,100]%"); var rect4 = new Rect(200f, num, 200f, 30f); // TextFieldNumericCoverage(rect4.LeftHalf()); ButtonCoverage(rect4.RightHalf()); // TooltipHandler.TipRegion(new Rect(0f, num, rect4.xMax, rect4.height), "PlanetCoverageTip".Translate()); num += 40f; Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetRainfall".Translate()); var rect5 = new Rect(200f, num, 200f, 30f); _rainfall = (OverallRainfall)Mathf.RoundToInt(Widgets.HorizontalSlider(rect5, (float)_rainfall, 0f, OverallRainfallUtility.EnumValuesCount - 1, true, "PlanetRainfall_Normal".Translate(), "PlanetRainfall_Low".Translate(), "PlanetRainfall_High".Translate(), 1f)); num += 40f; Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetTemperature".Translate()); var rect6 = new Rect(200f, num, 200f, 30f); _temperature = (OverallTemperature)Mathf.RoundToInt(Widgets.HorizontalSlider(rect6, (float)_temperature, 0f, OverallTemperatureUtility.EnumValuesCount - 1, true, "PlanetTemperature_Normal".Translate(), "PlanetTemperature_Low".Translate(), "PlanetTemperature_High".Translate(), 1f)); GUI.EndGroup(); DoBottomButtons(rect, "WorldGenerate".Translate(), "Reset".Translate(), Reset); }
public void Reset() { this.seedString = GenText.RandomSeedString(); this.planetCoverage = 0.3f; this.worldPreset = "Planets.Vanilla"; Planets_GameComponent.axialTilt = AxialTilt.Normal; Planets_GameComponent.worldType = WorldType.Vanilla; Planets_GameComponent.subcount = 10; this.rainfallMod = RainfallModifier.Normal; this.temperature = OverallTemperature.Normal; }
public static SimpleCurve GetTemperatureCurve(this OverallTemperature overallTemperature) { return(overallTemperature switch { OverallTemperature.VeryCold => Curve_VeryCold, OverallTemperature.Cold => Curve_Cold, OverallTemperature.LittleBitColder => Curve_LittleBitColder, OverallTemperature.LittleBitWarmer => Curve_LittleBitWarmer, OverallTemperature.Hot => Curve_Hot, OverallTemperature.VeryHot => Curve_VeryHot, _ => null, });
private void DoTemperatureSlider(float single) { Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetTemperature".Translate()); Rect rect = new Rect(200f, single, 200f, 30f); OverallTemperature temperatureCheck = this.temperature; this.temperature = (OverallTemperature)Mathf.RoundToInt(Widgets.HorizontalSlider(rect, (float)this.temperature, 0f, (float)(OverallTemperatureUtility.EnumValuesCount - 1), true, "PlanetTemperature_Normal".Translate(), "PlanetTemperature_Low".Translate(), "PlanetTemperature_High".Translate(), 1f)); if (this.temperature != temperatureCheck) { this.CurrentWorldPreset = "Planets.Custom"; } }
private void ApplyWorldPreset(WorldPreset worldPreset) { this.CurrentWorldPreset = worldPreset.Name; if (this.CurrentWorldPreset != "Planets.Custom") { Planets_GameComponent.worldType = worldPreset.WorldType; Planets_GameComponent.axialTilt = worldPreset.AxialTilt; this.rainfallMod = worldPreset.RainfallModifier; this.temperature = worldPreset.Temperature; this.population = worldPreset.Population; } }
public void Randomize() { this.seedString = GenText.RandomSeedString(); Planets_GameComponent.axialTilt = Planets_Random.GetRandomAxialTilt(); Planets_GameComponent.worldType = Planets_Random.GetRandomWorldType(); this.rainfallMod = Planets_Random.GetRandomRainfallModifier(); this.temperature = Planets_Random.GetRandomTemperature(); this.population = Planets_Random.GetRandomPopulation(); this.CurrentWorldPreset = "Planets.Custom"; Controller.Settings.randomPlanet = true; if (this.CanDoNext()) { this.DoNext(); } }
public static SimpleCurve curve; // not sure if this needs to be scoped here or not... public static SimpleCurve GetTemperatureCurve(int versionNumber, OverallTemperature overallTemperature) { switch (versionNumber) { case 0: curve = OverallTemperatureUtility.Curve_VeryCold_V0; break; case 1: curve = OverallTemperatureUtility.Curve_VeryCold_V1; break; default: curve = OverallTemperatureUtility.Curve_VeryCold_V1; break; } switch (overallTemperature) { case OverallTemperature.VeryCold: return(curve); case OverallTemperature.Cold: return(OverallTemperatureUtility.Curve_Cold); case OverallTemperature.LittleBitColder: return(OverallTemperatureUtility.Curve_LittleBitColder); case OverallTemperature.LittleBitWarmer: return(OverallTemperatureUtility.Curve_LittleBitWarmer); case OverallTemperature.Hot: return(OverallTemperatureUtility.Curve_Hot); case OverallTemperature.VeryHot: return(OverallTemperatureUtility.Curve_VeryHot); } return(null); }
public static World GenerateWorld(float planetCoverage, string seedString, OverallRainfall overallRainfall, OverallTemperature overallTemperature) { DeepProfiler.Start("GenerateWorld"); Rand.Seed = (GenText.StableStringHash(seedString) ^ 4323276); Current.CreatingWorld = new World(); Current.CreatingWorld.info.planetCoverage = planetCoverage; Current.CreatingWorld.info.seedString = seedString; Current.CreatingWorld.info.overallRainfall = overallRainfall; Current.CreatingWorld.info.overallTemperature = overallTemperature; Current.CreatingWorld.info.name = NameGenerator.GenerateName(RulePackDefOf.NamerWorld, null, false, null); foreach (WorldGenStepDef current in from gs in DefDatabase <WorldGenStepDef> .AllDefs orderby gs.order select gs) { DeepProfiler.Start("WorldGenStep - " + current); try { current.worldGenStep.GenerateFresh(seedString); } catch (Exception arg) { Log.Error("Error in WorldGenStep: " + arg); } finally { DeepProfiler.End(); } } Current.CreatingWorld.grid.StandardizeTileData(); Current.CreatingWorld.FinalizeInit(); Find.Scenario.PostWorldGenerate(); World creatingWorld = Current.CreatingWorld; Current.CreatingWorld = null; DeepProfiler.End(); return(creatingWorld); }
public override void DoWindowContents(Rect rect) { base.DrawPageTitle(rect); GUI.BeginGroup(base.GetMainRect(rect, 0f, false)); Text.Font = GameFont.Small; float single = 0f; Widgets.Label(new Rect(0f, single, 200f, 30f), "WorldSeed".Translate()); Rect rect1 = new Rect(200f, single, 200f, 30f); this.seedString = Widgets.TextField(rect1, this.seedString); single = single + 40f; Rect rect2 = new Rect(200f, single, 200f, 30f); if (Widgets.ButtonText(rect2, "RandomizeSeed".Translate(), true, false, true)) { SoundDefOf.TickTiny.PlayOneShotOnCamera(null); this.seedString = GenText.RandomSeedString(); } single = single + 40f; Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetCoverage".Translate()); Rect rect3 = new Rect(200f, single, 200f, 30f); if (Widgets.ButtonText(rect3, this.planetCoverage.ToStringPercent(), true, false, true)) { List <FloatMenuOption> floatMenuOptions = new List <FloatMenuOption>(); float[] singleArray = (!Prefs.DevMode ? ProCWP.PlanetCoverages : ProCWP.PlanetCoveragesDev); for (int i = 0; i < (int)singleArray.Length; i++) { float single1 = singleArray[i]; string stringPercent = single1.ToStringPercent(); if (single1 <= 0.1f) { stringPercent = string.Concat(stringPercent, " (dev)"); } FloatMenuOption floatMenuOption = new FloatMenuOption(stringPercent, () => { if (this.planetCoverage != single1) { this.planetCoverage = single1; if (this.planetCoverage == 1f) { Messages.Message("MessageMaxPlanetCoveragePerformanceWarning".Translate(), MessageSound.Standard); } } }, MenuOptionPriority.Default, null, null, 0f, null, null); floatMenuOptions.Add(floatMenuOption); } Find.WindowStack.Add(new FloatMenu(floatMenuOptions)); } TooltipHandler.TipRegion(new Rect(0f, single, rect3.xMax, rect3.height), "PlanetCoverageTip".Translate()); single = single + 40f; Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetRainfall".Translate()); Rect rect4 = new Rect(200f, single, 200f, 30f); this.rainfall = (OverallRainfall)Mathf.RoundToInt(Widgets.HorizontalSlider(rect4, (float)this.rainfall, 0f, (float)(OverallRainfallUtility.EnumValuesCount - 1), true, "PlanetRainfall_Normal".Translate(), "PlanetRainfall_Low".Translate(), "PlanetRainfall_High".Translate(), 1f)); single = single + 40f; Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetTemperature".Translate()); Rect rect5 = new Rect(200f, single, 200f, 30f); this.temperature = (OverallTemperature)Mathf.RoundToInt(Widgets.HorizontalSlider(rect5, (float)this.temperature, 0f, (float)(OverallTemperatureUtility.EnumValuesCount - 1), true, "PlanetTemperature_Normal".Translate(), "PlanetTemperature_Low".Translate(), "PlanetTemperature_High".Translate(), 1f)); GUI.EndGroup(); base.DoBottomButtons(rect, "WorldGenerate".Translate(), "Reset".Translate(), new Action(this.Reset), true); }
public static SimpleCurve GetTemperatureCurveHelper(OverallTemperature overallTemperature) { return(OverallTemperatureUtility.GetTemperatureCurve(ExtremeColdsMod.settings.currentVersion, overallTemperature)); }
public static void Postfix(this OverallTemperature overallTemperature, ref SimpleCurve __result) { if (overallTemperature == OverallTemperature.VeryCold) { SimpleCurve Curve_VeryCold_Revised = new SimpleCurve { { new CurvePoint(-9999f, -9999f), true }, { new CurvePoint(-50f, -90f), true }, { new CurvePoint(-40f, -75f), true }, { new CurvePoint(0f, -50f), true }, { new CurvePoint(20f, -43f), true }, { new CurvePoint(25f, -33f), true }, { new CurvePoint(30f, -23.5f), true }, { new CurvePoint(50f, -22f), true } }; __result = Curve_VeryCold_Revised; } if (overallTemperature == OverallTemperature.Cold) { SimpleCurve Curve_Cold_Revised = new SimpleCurve { { new CurvePoint(-9999f, -9999f), true }, { new CurvePoint(-50f, -78f), true }, { new CurvePoint(-25f, -48f), true }, { new CurvePoint(-20f, -33f), true }, { new CurvePoint(-13f, -23f), true }, { new CurvePoint(0f, -20f), true }, { new CurvePoint(30f, -11f), true }, { new CurvePoint(60f, 17f), true } }; __result = Curve_Cold_Revised; } if (overallTemperature == OverallTemperature.LittleBitColder) { SimpleCurve Curve_LittleBitColder_Revised = new SimpleCurve { { new CurvePoint(-9999f, -9999f), true }, { new CurvePoint(-20f, -25f), true }, { new CurvePoint(-15f, -18f), true }, { new CurvePoint(-5f, -16f), true }, { new CurvePoint(40f, 27f), true }, { new CurvePoint(9999f, 9999f), true } }; __result = Curve_LittleBitColder_Revised; } if (overallTemperature == OverallTemperature.LittleBitWarmer) { SimpleCurve Curve_LittleBitWarmer_Revised = new SimpleCurve { { new CurvePoint(-9999f, -9999f), true }, { new CurvePoint(-45f, -32f), true }, { new CurvePoint(40f, 53f), true }, { new CurvePoint(120f, 123f), true }, { new CurvePoint(9999f, 9999f), true } }; __result = Curve_LittleBitWarmer_Revised; } if (overallTemperature == OverallTemperature.Hot) { SimpleCurve Curve_Hot_Revised = new SimpleCurve { { new CurvePoint(-45f, -14f), true }, { new CurvePoint(-25f, -4f), true }, { new CurvePoint(-22f, 10f), true }, { new CurvePoint(-10f, 33f), true }, { new CurvePoint(40f, 65f), true }, { new CurvePoint(120f, 128f), true }, { new CurvePoint(9999f, 9999f), true } }; __result = Curve_Hot_Revised; } if (overallTemperature == OverallTemperature.VeryHot) { SimpleCurve Curve_VeryHot_Revised = new SimpleCurve { { new CurvePoint(-45f, 40f), true }, { new CurvePoint(0f, 55f), true }, { new CurvePoint(33f, 95f), true }, { new CurvePoint(40f, 103f), true }, { new CurvePoint(120f, 135f), true }, { new CurvePoint(9999f, 9999f), true } }; __result = Curve_VeryHot_Revised; } }
public override void DoWindowContents(Rect rect) { DrawPageTitle(rect); GUI.BeginGroup(GetMainRect(rect)); Text.Font = GameFont.Small; float num = 0f; Widgets.Label(new Rect(0f, num, 200f, 30f), "WorldSeed".Translate()); Rect rect2 = new Rect(200f, num, 200f, 30f); seedString = Widgets.TextField(rect2, seedString); num += 40f; if (Widgets.ButtonText(new Rect(200f, num, 200f, 30f), "RandomizeSeed".Translate())) { SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(); seedString = GenText.RandomSeedString(); } num += 40f; Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetCoverage".Translate()); Rect rect3 = new Rect(200f, num, 200f, 30f); if (Widgets.ButtonText(rect3, planetCoverage.ToStringPercent())) { List <FloatMenuOption> list = new List <FloatMenuOption>(); float[] array = Prefs.DevMode ? PlanetCoveragesDev : PlanetCoverages; foreach (float coverage in array) { string text = coverage.ToStringPercent(); if (coverage <= 0.1f) { text += " (dev)"; } FloatMenuOption item = new FloatMenuOption(text, delegate { if (planetCoverage != coverage) { planetCoverage = coverage; if (planetCoverage == 1f) { Messages.Message("MessageMaxPlanetCoveragePerformanceWarning".Translate(), MessageTypeDefOf.CautionInput, historical: false); } } }); list.Add(item); } Find.WindowStack.Add(new FloatMenu(list)); } TooltipHandler.TipRegionByKey(new Rect(0f, num, rect3.xMax, rect3.height), "PlanetCoverageTip"); num += 40f; Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetRainfall".Translate()); Rect rect4 = new Rect(200f, num, 200f, 30f); rainfall = (OverallRainfall)Mathf.RoundToInt(Widgets.HorizontalSlider(rect4, (float)rainfall, 0f, OverallRainfallUtility.EnumValuesCount - 1, middleAlignment: true, "PlanetRainfall_Normal".Translate(), "PlanetRainfall_Low".Translate(), "PlanetRainfall_High".Translate(), 1f)); num += 40f; Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetTemperature".Translate()); Rect rect5 = new Rect(200f, num, 200f, 30f); temperature = (OverallTemperature)Mathf.RoundToInt(Widgets.HorizontalSlider(rect5, (float)temperature, 0f, OverallTemperatureUtility.EnumValuesCount - 1, middleAlignment: true, "PlanetTemperature_Normal".Translate(), "PlanetTemperature_Low".Translate(), "PlanetTemperature_High".Translate(), 1f)); num += 40f; Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetPopulation".Translate()); Rect rect6 = new Rect(200f, num, 200f, 30f); population = (OverallPopulation)Mathf.RoundToInt(Widgets.HorizontalSlider(rect6, (float)population, 0f, OverallPopulationUtility.EnumValuesCount - 1, middleAlignment: true, "PlanetPopulation_Normal".Translate(), "PlanetPopulation_Low".Translate(), "PlanetPopulation_High".Translate(), 1f)); num += 40f; Widgets.Label(new Rect(0f, num, 200f, 30f), "AAAA".Translate()); Rect rect7 = new Rect(200f, num, 200f, 30f); GUI.EndGroup(); DoBottomButtons(rect, "WorldGenerate".Translate(), "Reset".Translate(), Reset); }
public override void DoWindowContents(Rect rect) { base.DrawPageTitle(rect); GUI.BeginGroup(base.GetMainRect(rect, 0f, false)); Text.Font = GameFont.Small; // // PLANET SEED // float single = 0f; Widgets.Label(new Rect(0f, single, 200f, 30f), "WorldSeed".Translate()); Rect rect1 = new Rect(200f, single, 200f, 30f); this.seedString = Widgets.TextField(rect1, this.seedString); single += 40f; Rect rect2 = new Rect(200f, single, 200f, 30f); if (Widgets.ButtonText(rect2, "RandomizeSeed".Translate(), true, false, true)) { SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(null); this.seedString = GenText.RandomSeedString(); } // // PLANET SIZE (IF "MY LITTLE PLANET" IS IN USE) // if (ModsConfig.ActiveModsInLoadOrder.Any(mod => mod.Name.Contains("My Little Planet"))) { single += 80f; Widgets.Label(new Rect(0f, single, 200f, 30f), "MLPWorldPlanetSize".Translate()); Rect rect7 = new Rect(200f, single, 200f, 30f); Planets_GameComponent.subcount = Mathf.RoundToInt(Widgets.HorizontalSlider(rect7, Planets_GameComponent.subcount, 6f, 10f, true, null, "MLPWorldTiny".Translate(), "MLPWorldDefault".Translate(), 1f)); } // // PLANET COVERAGE // single += 80f; Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetCoverage".Translate()); Rect rect3 = new Rect(200f, single, 200f, 30f); if (Widgets.ButtonText(rect3, this.planetCoverage.ToStringPercent(), true, false, true)) { List <FloatMenuOption> floatMenuOptions = new List <FloatMenuOption>(); float[] singleArray = Planets_CreateWorldParams.PlanetCoverages; for (int i = 0; i < (int)singleArray.Length; i++) { float single1 = singleArray[i]; string stringPercent = single1.ToStringPercent(); FloatMenuOption floatMenuOption = new FloatMenuOption(stringPercent, () => { if (this.planetCoverage != single1) { this.planetCoverage = single1; if (this.planetCoverage < 0.15f) { Messages.Message("Planets.MessageLowPlanetCoverageWarning".Translate(), MessageTypeDefOf.CautionInput, false); } if (this.planetCoverage > 0.7f) { Messages.Message("MessageMaxPlanetCoveragePerformanceWarning".Translate(), MessageTypeDefOf.CautionInput, false); } } }, MenuOptionPriority.Default, null, null, 0f, null, null); floatMenuOptions.Add(floatMenuOption); } Find.WindowStack.Add(new FloatMenu(floatMenuOptions)); } TooltipHandler.TipRegion(new Rect(0f, single, rect3.xMax, rect3.height), "PlanetCoverageTip".Translate()); // // WORLD TYPE PRESETS // single += 80f; Widgets.Label(new Rect(0f, single, 200f, 30f), "Planets.WorldPresets".Translate()); Rect rect8 = new Rect(200f, single, 200f, 30f); if (Widgets.ButtonText(rect8, this.WorldPreset.Translate(), true, false, true)) { List <FloatMenuOption> floatMenuOptions = new List <FloatMenuOption>(); string[] singleArray = Planets_CreateWorldParams.WorldPresets; for (int i = 0; i < (int)singleArray.Length; i++) { string single1 = singleArray[i]; string single1Translated = single1.Translate(); FloatMenuOption floatMenuOption = new FloatMenuOption(single1Translated, () => { if (this.WorldPreset != single1) { this.WorldPreset = single1; #region Presets if (this.WorldPreset == "Planets.Vanilla") { Planets_GameComponent.worldType = WorldType.Vanilla; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.Normal; this.temperature = OverallTemperature.Normal; this.population = OverallPopulation.Normal; } else if (this.WorldPreset == "Planets.Desert") { Planets_GameComponent.worldType = WorldType.Dry; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.LittleBitLess; this.temperature = OverallTemperature.LittleBitWarmer; this.population = OverallPopulation.LittleBitLess; } else if (this.WorldPreset == "Planets.Frozen") { Planets_GameComponent.worldType = WorldType.VeryDry; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.LittleBitLess; this.temperature = OverallTemperature.Cold; this.population = OverallPopulation.LittleBitLess; } else if (this.WorldPreset == "Planets.Earthlike") { Planets_GameComponent.worldType = WorldType.Earthlike; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.Normal; this.temperature = OverallTemperature.Normal; this.population = OverallPopulation.Normal; } else if (this.WorldPreset == "Planets.Forest") { Planets_GameComponent.worldType = WorldType.Vanilla; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.LittleBitMore; this.temperature = OverallTemperature.LittleBitColder; this.population = OverallPopulation.LittleBitMore; } else if (this.WorldPreset == "Planets.Iceball") { Planets_GameComponent.worldType = WorldType.Vanilla; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.Normal; this.temperature = OverallTemperature.VeryCold; this.population = OverallPopulation.Little; } else if (this.WorldPreset == "Planets.Jungle") { Planets_GameComponent.worldType = WorldType.Earthlike; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.LittleBitMore; this.temperature = OverallTemperature.LittleBitWarmer; this.population = OverallPopulation.High; } else if (this.WorldPreset == "Planets.Ocean") { Planets_GameComponent.worldType = WorldType.Waterworld; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.Normal; this.temperature = OverallTemperature.Normal; this.population = OverallPopulation.AlmostNone; } else { } #endregion } }, MenuOptionPriority.Default, null, null, 0f, null, null); floatMenuOptions.Add(floatMenuOption); } Find.WindowStack.Add(new FloatMenu(floatMenuOptions)); } TooltipHandler.TipRegion(new Rect(0f, single, rect8.xMax, rect8.height), "Planets.WorldPresetsTip".Translate()); { single += 80f; DoSeaLevelSlider(single); single += 40f; DoRainfallSlider(single); single += 40f; DoTemperatureSlider(single); single += 40f; DoAxialTiltSlider(single); // Faction Control will override population, so disable this slider if Faction Control is enabled if (Controller.FactionControlSettingsMI == null) { single += 40f; DoPopulationSlider(single); } } GUI.EndGroup(); // // BOTTOM BUTTONS // if (Controller.FactionControlSettingsMI != null) { Text.Font = GameFont.Small; if (Widgets.ButtonText(new Rect(0, rect.yMax - 78f, 150, 32), "RFC.FactionControlName".Translate())) { Controller.FactionControlSettingsMI.Invoke(null, null); } } base.DoBottomButtons(rect, "WorldGenerate".Translate(), "Planets.Random".Translate(), new Action(this.Randomize), true, true); }
public static void Prefix(ref float planetCoverage, ref string seedString, ref OverallRainfall overallRainfall, ref OverallTemperature overallTemperature) { Loger.Log("Client HarmonyPatch WorldGenerator.GenerateWorld()"); //параметры генерации мира if (GameStarter.SetPlanetCoverage > 0) { planetCoverage = GameStarter.SetPlanetCoverage; } if (!string.IsNullOrEmpty(GameStarter.SetSeed)) { seedString = GameStarter.SetSeed; } if (GameStarter.SetPlanetCoverage > 0 || !string.IsNullOrEmpty(GameStarter.SetSeed)) { overallRainfall = GameStarter.SetOverallRainfall; overallTemperature = GameStarter.SetOverallTemperature; } }
public WorldPresetBuilder Temperature(OverallTemperature value) { this.temperature = value; return(this); }
public override void DoWindowContents(Rect rect) { base.DrawPageTitle(rect); GUI.BeginGroup(base.GetMainRect(rect, 0f, false)); Text.Font = GameFont.Small; // // PLANET SEED // float single = 0f; Widgets.Label(new Rect(0f, single, 200f, 30f), "WorldSeed".Translate()); Rect rect1 = new Rect(200f, single, 200f, 30f); this.seedString = Widgets.TextField(rect1, this.seedString); single += 40f; Rect rect2 = new Rect(200f, single, 200f, 30f); if (Widgets.ButtonText(rect2, "RandomizeSeed".Translate(), true, false, true)) { SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(null); this.seedString = GenText.RandomSeedString(); } // // PLANET SIZE (IF "MY LITTLE PLANET" IS IN USE) // if (ModsConfig.ActiveModsInLoadOrder.Any(mod => mod.Name.Contains("My Little Planet"))) { single += 80f; Widgets.Label(new Rect(0f, single, 200f, 30f), "MLPWorldPlanetSize".Translate()); Rect rect7 = new Rect(200f, single, 200f, 30f); Planets_GameComponent.subcount = Mathf.RoundToInt(Widgets.HorizontalSlider(rect7, Planets_GameComponent.subcount, 6f, 10f, true, null, "MLPWorldTiny".Translate(), "MLPWorldDefault".Translate(), 1f)); } // // PLANET COVERAGE // single += 80f; Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetCoverage".Translate()); Rect rect3 = new Rect(200f, single, 200f, 30f); if (Widgets.ButtonText(rect3, this.planetCoverage.ToStringPercent(), true, false, true)) { List <FloatMenuOption> floatMenuOptions = new List <FloatMenuOption>(); float[] singleArray = Planets_CreateWorldParams.PlanetCoverages; for (int i = 0; i < (int)singleArray.Length; i++) { float single1 = singleArray[i]; string stringPercent = single1.ToStringPercent(); FloatMenuOption floatMenuOption = new FloatMenuOption(stringPercent, () => { if (this.planetCoverage != single1) { this.planetCoverage = single1; if (this.planetCoverage < 0.15f) { Messages.Message("Planets.MessageLowPlanetCoverageWarning".Translate(), MessageTypeDefOf.CautionInput, false); } if (this.planetCoverage > 0.7f) { Messages.Message("MessageMaxPlanetCoveragePerformanceWarning".Translate(), MessageTypeDefOf.CautionInput, false); } } }, MenuOptionPriority.Default, null, null, 0f, null, null); floatMenuOptions.Add(floatMenuOption); } Find.WindowStack.Add(new FloatMenu(floatMenuOptions)); } TooltipHandler.TipRegion(new Rect(0f, single, rect3.xMax, rect3.height), "PlanetCoverageTip".Translate()); // // WORLD TYPE PRESETS // single += 80f; Widgets.Label(new Rect(0f, single, 200f, 30f), "Planets.WorldPresets".Translate()); Rect rect8 = new Rect(200f, single, 200f, 30f); if (Widgets.ButtonText(rect8, this.worldPreset.Translate(), true, false, true)) { List <FloatMenuOption> floatMenuOptions = new List <FloatMenuOption>(); string[] singleArray = Planets_CreateWorldParams.WorldPresets; for (int i = 0; i < (int)singleArray.Length; i++) { string single1 = singleArray[i]; string single1Translated = single1.Translate(); FloatMenuOption floatMenuOption = new FloatMenuOption(single1Translated, () => { if (this.worldPreset != single1) { this.worldPreset = single1; if (this.worldPreset == "Planets.Vanilla") { Planets_GameComponent.worldType = WorldType.Vanilla; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.Normal; this.temperature = OverallTemperature.Normal; } else if (this.worldPreset == "Planets.Desert") { Planets_GameComponent.worldType = WorldType.Dry; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.LittleBitLess; this.temperature = OverallTemperature.LittleBitWarmer; } else if (this.worldPreset == "Planets.Frozen") { Planets_GameComponent.worldType = WorldType.VeryDry; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.LittleBitLess; this.temperature = OverallTemperature.Cold; } else if (this.worldPreset == "Planets.Earthlike") { Planets_GameComponent.worldType = WorldType.Earthlike; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.Normal; this.temperature = OverallTemperature.Normal; } else if (this.worldPreset == "Planets.Forest") { Planets_GameComponent.worldType = WorldType.Vanilla; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.LittleBitMore; this.temperature = OverallTemperature.LittleBitColder; } else if (this.worldPreset == "Planets.Iceball") { Planets_GameComponent.worldType = WorldType.Vanilla; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.Normal; this.temperature = OverallTemperature.VeryCold; } else if (this.worldPreset == "Planets.Jungle") { Planets_GameComponent.worldType = WorldType.Earthlike; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.LittleBitMore; this.temperature = OverallTemperature.LittleBitWarmer; } else if (this.worldPreset == "Planets.Ocean") { Planets_GameComponent.worldType = WorldType.Waterworld; Planets_GameComponent.axialTilt = AxialTilt.Normal; this.rainfallMod = RainfallModifier.Normal; this.temperature = OverallTemperature.Normal; } else { } } }, MenuOptionPriority.Default, null, null, 0f, null, null); floatMenuOptions.Add(floatMenuOption); } Find.WindowStack.Add(new FloatMenu(floatMenuOptions)); } TooltipHandler.TipRegion(new Rect(0f, single, rect8.xMax, rect8.height), "Planets.WorldPresetsTip".Translate()); // // OCEAN SLIDER // single += 80f; Widgets.Label(new Rect(0f, single, 200f, 30f), "Planets.OceanType".Translate()); Rect rect6 = new Rect(200f, single, 200f, 30f); WorldType worldTypeCheck = Planets_GameComponent.worldType; Planets_GameComponent.worldType = (WorldType)Mathf.RoundToInt(Widgets.HorizontalSlider(rect6, (float)Planets_GameComponent.worldType, 0f, (float)(WorldTypeUtility.EnumValuesCount - 1), true, "Planets.OceanType_Earthlike".Translate(), "Planets.OceanType_Waterworld".Translate(), "Planets.OceanType_Barren".Translate(), 1f)); if (Planets_GameComponent.worldType != worldTypeCheck) { this.worldPreset = "Planets.Custom"; } TooltipHandler.TipRegion(new Rect(0f, single, rect6.xMax, rect6.height), "Planets.OceanTypeTip".Translate()); // // RAINFALL SLIDER // single += 40f; Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetRainfall".Translate()); Rect rect4 = new Rect(200f, single, 200f, 30f); RainfallModifier rainfallModCheck = this.rainfallMod; this.rainfallMod = (RainfallModifier)Mathf.RoundToInt(Widgets.HorizontalSlider(rect4, (float)this.rainfallMod, 0f, (float)(RainfallModifierUtility.EnumValuesCount - 1), true, "PlanetRainfall_Normal".Translate(), "PlanetRainfall_Low".Translate(), "PlanetRainfall_High".Translate(), 1f)); if (this.rainfallMod != rainfallModCheck) { this.worldPreset = "Planets.Custom"; } TooltipHandler.TipRegion(new Rect(0f, single, rect4.xMax, rect4.height), "Planets.RainfallTip".Translate()); // // TEMPERATURE SLIDER // single += 40f; Widgets.Label(new Rect(0f, single, 200f, 30f), "PlanetTemperature".Translate()); Rect rect5 = new Rect(200f, single, 200f, 30f); OverallTemperature temperatureCheck = this.temperature; this.temperature = (OverallTemperature)Mathf.RoundToInt(Widgets.HorizontalSlider(rect5, (float)this.temperature, 0f, (float)(OverallTemperatureUtility.EnumValuesCount - 1), true, "PlanetTemperature_Normal".Translate(), "PlanetTemperature_Low".Translate(), "PlanetTemperature_High".Translate(), 1f)); if (this.temperature != temperatureCheck) { this.worldPreset = "Planets.Custom"; } // // AXIAL TILT // single += 40f; Widgets.Label(new Rect(0f, single, 200f, 30f), "Planets.AxialTilt".Translate()); Rect rect9 = new Rect(200f, single, 200f, 30f); AxialTilt axialTiltCheck = Planets_GameComponent.axialTilt; Planets_GameComponent.axialTilt = (AxialTilt)Mathf.RoundToInt(Widgets.HorizontalSlider(rect9, (float)Planets_GameComponent.axialTilt, 0f, (float)(AxialTiltUtility.EnumValuesCount - 1), true, "Planets.AxialTilt_Normal".Translate(), "Planets.AxialTilt_Low".Translate(), "Planets.AxialTilt_High".Translate(), 1f)); if (Planets_GameComponent.axialTilt != axialTiltCheck) { this.worldPreset = "Planets.Custom"; } TooltipHandler.TipRegion(new Rect(0f, single, rect9.xMax, rect9.height), "Planets.AxialTiltTip".Translate()); GUI.EndGroup(); // // BOTTOM BUTTONS // base.DoBottomButtons(rect, "WorldGenerate".Translate(), "Planets.Random".Translate(), new Action(this.Randomize), true, true); }
public override void DoWindowContents(Rect rect) { base.DrawPageTitle(rect); GUI.BeginGroup(base.GetMainRect(rect, 0f, false)); Text.Font = GameFont.Small; float num = 0f; Widgets.Label(new Rect(0f, num, 200f, 30f), "WorldSeed".Translate()); Rect rect2 = new Rect(200f, num, 200f, 30f); this.seedString = Widgets.TextField(rect2, this.seedString); num += 40f; Rect rect3 = new Rect(200f, num, 200f, 30f); if (Widgets.ButtonText(rect3, "RandomizeSeed".Translate(), true, false, true)) { SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(null); this.seedString = GenText.RandomSeedString(); } num += 40f; Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetCoverage".Translate()); Rect rect4 = new Rect(200f, num, 200f, 30f); if (Widgets.ButtonText(rect4, this.planetCoverage.ToStringPercent(), true, false, true)) { List <FloatMenuOption> list = new List <FloatMenuOption>(); float[] array = (!Prefs.DevMode) ? Page_CreateWorldParams.PlanetCoverages : Page_CreateWorldParams.PlanetCoveragesDev; for (int i = 0; i < array.Length; i++) { float coverage = array[i]; string text = coverage.ToStringPercent(); if (coverage <= 0.1f) { text += " (dev)"; } FloatMenuOption item = new FloatMenuOption(text, delegate { if (this.planetCoverage != coverage) { this.planetCoverage = coverage; if (this.planetCoverage == 1f) { Messages.Message("MessageMaxPlanetCoveragePerformanceWarning".Translate(), MessageTypeDefOf.CautionInput, false); } } }, MenuOptionPriority.Default, null, null, 0f, null, null); list.Add(item); } Find.WindowStack.Add(new FloatMenu(list)); } TooltipHandler.TipRegion(new Rect(0f, num, rect4.xMax, rect4.height), "PlanetCoverageTip".Translate()); num += 40f; Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetRainfall".Translate()); Rect rect5 = new Rect(200f, num, 200f, 30f); this.rainfall = (OverallRainfall)Mathf.RoundToInt(Widgets.HorizontalSlider(rect5, (float)this.rainfall, 0f, (float)(OverallRainfallUtility.EnumValuesCount - 1), true, "PlanetRainfall_Normal".Translate(), "PlanetRainfall_Low".Translate(), "PlanetRainfall_High".Translate(), 1f)); num += 40f; Widgets.Label(new Rect(0f, num, 200f, 30f), "PlanetTemperature".Translate()); Rect rect6 = new Rect(200f, num, 200f, 30f); this.temperature = (OverallTemperature)Mathf.RoundToInt(Widgets.HorizontalSlider(rect6, (float)this.temperature, 0f, (float)(OverallTemperatureUtility.EnumValuesCount - 1), true, "PlanetTemperature_Normal".Translate(), "PlanetTemperature_Low".Translate(), "PlanetTemperature_High".Translate(), 1f)); GUI.EndGroup(); base.DoBottomButtons(rect, "WorldGenerate".Translate(), "Reset".Translate(), new Action(this.Reset), true, true); }
public void Randomize() { this.seedString = GenText.RandomSeedString(); float randTilt = Rand.Value; if (randTilt > 0.8) { Planets_GameComponent.axialTilt = AxialTilt.VeryLow; } else if (randTilt > 0.6) { Planets_GameComponent.axialTilt = AxialTilt.Low; } else if (randTilt > 0.4) { Planets_GameComponent.axialTilt = AxialTilt.Normal; } else if (randTilt > 0.2) { Planets_GameComponent.axialTilt = AxialTilt.High; } else { Planets_GameComponent.axialTilt = AxialTilt.VeryHigh; } float randType = Rand.Value; if (randType > 0.86) { Planets_GameComponent.worldType = WorldType.Waterworld; } else if (randType > 0.72) { Planets_GameComponent.worldType = WorldType.Islands; } else if (randType > 0.58) { Planets_GameComponent.worldType = WorldType.Earthlike; } else if (randType > 0.42) { Planets_GameComponent.worldType = WorldType.Vanilla; } else if (randType > 0.28) { Planets_GameComponent.worldType = WorldType.Dry; } else if (randType > 0.14) { Planets_GameComponent.worldType = WorldType.VeryDry; } else { Planets_GameComponent.worldType = WorldType.Barren; } float randRain = Rand.Value; if (randRain > 0.8) { this.rainfallMod = RainfallModifier.Little; } else if (randRain > 0.6) { this.rainfallMod = RainfallModifier.LittleBitLess; } else if (randRain > 0.4) { this.rainfallMod = RainfallModifier.Normal; } else if (randRain > 0.2) { this.rainfallMod = RainfallModifier.LittleBitMore; } else { this.rainfallMod = RainfallModifier.High; } float randTemp = Rand.Value; if (randTemp > 0.86) { this.temperature = OverallTemperature.VeryCold; } else if (randTemp > 0.72) { this.temperature = OverallTemperature.Cold; } else if (randTemp > 0.58) { this.temperature = OverallTemperature.LittleBitColder; } else if (randTemp > 0.42) { this.temperature = OverallTemperature.Normal; } else if (randTemp > 0.28) { this.temperature = OverallTemperature.LittleBitWarmer; } else if (randTemp > 0.14) { this.temperature = OverallTemperature.Hot; } else { this.temperature = OverallTemperature.VeryHot; } Controller.Settings.randomPlanet = true; if (this.CanDoNext()) { this.DoNext(); } }
public static World GenerateWorld(float planetCoverage, string seedString, OverallRainfall overallRainfall, OverallTemperature overallTemperature) { DeepProfiler.Start("GenerateWorld"); Rand.PushState(); int seed = Rand.Seed = GetSeedFromSeedString(seedString); try { Current.CreatingWorld = new World(); Current.CreatingWorld.info.seedString = seedString; Current.CreatingWorld.info.planetCoverage = planetCoverage; Current.CreatingWorld.info.overallRainfall = overallRainfall; Current.CreatingWorld.info.overallTemperature = overallTemperature; Current.CreatingWorld.info.name = NameGenerator.GenerateName(RulePackDefOf.NamerWorld); tmpGenSteps.Clear(); tmpGenSteps.AddRange(GenStepsInOrder); for (int i = 0; i < tmpGenSteps.Count; i++) { DeepProfiler.Start("WorldGenStep - " + tmpGenSteps[i]); try { Rand.Seed = Gen.HashCombineInt(seed, GetSeedPart(tmpGenSteps, i)); tmpGenSteps[i].worldGenStep.GenerateFresh(seedString); } catch (Exception arg) { Log.Error("Error in WorldGenStep: " + arg); } finally { DeepProfiler.End(); } } Rand.Seed = seed; Current.CreatingWorld.grid.StandardizeTileData(); Current.CreatingWorld.FinalizeInit(); Find.Scenario.PostWorldGenerate(); return(Current.CreatingWorld); } finally { Rand.PopState(); DeepProfiler.End(); Current.CreatingWorld = null; } }
public static World GenerateWorld(float planetCoverage, string seedString, OverallRainfall overallRainfall, OverallTemperature overallTemperature) { Rand.Seed = (GenText.StableStringHash(seedString) ^ 4323276); Current.CreatingWorld = new World(); Current.CreatingWorld.info.planetCoverage = planetCoverage; Current.CreatingWorld.info.seedString = seedString; Current.CreatingWorld.info.overallRainfall = overallRainfall; Current.CreatingWorld.info.overallTemperature = overallTemperature; Current.CreatingWorld.info.name = NameGenerator.GenerateName(RulePackDefOf.NamerWorld, null, false); WorldGenerator_Grid.GenerateGridIntoWorld(seedString); Current.CreatingWorld.ConstructComponents(); FactionGenerator.GenerateFactionsIntoWorld(seedString); Current.CreatingWorld.FinalizeInit(); World creatingWorld = Current.CreatingWorld; Current.CreatingWorld = null; return(creatingWorld); }