public override void ExposeData() { if (WorldSettings == null) { WorldSettings = new WorldSettings(); } if (MapSettings == null) { MapSettings = new MapSettings(); } base.ExposeData(); Scribe_Deep.Look(ref WorldSettings, "WorldSettings"); Scribe_Deep.Look(ref MapSettings, "MapSettings"); if (Scribe.mode == LoadSaveMode.Saving) { CurrentSettings.ApplySettings(cgFieldValues); } DefsUtil.Restore(); }
public void DoWindowContents(Rect rect) { if (WorldSettings == null) { WorldSettings = new WorldSettings(); } if (MapSettings == null) { MapSettings = new MapSettings(); } if (CurrentSettings == null) { CurrentSettings = new CurrentSettings(); } string label; if (toShow == ToShow.None) { label = "WorldChooseButton".Translate(); } else if (toShow == ToShow.World) { label = WorldSettings.Name; } else { label = MapSettings.Name; } if (Widgets.ButtonText(new Rect(rect.x, rect.y, 300, 28), label)) { List <FloatMenuOption> l = new List <FloatMenuOption>(3) { new FloatMenuOption(WorldSettings.Name, () => { toShow = ToShow.World; }), new FloatMenuOption(MapSettings.Name, () => { toShow = ToShow.Map; }) }; if (Current.Game != null) { l.Add(new FloatMenuOption(CurrentSettings.Name, () => { toShow = ToShow.CurrentGame; })); } Find.WindowStack.Add(new FloatMenu(l)); } rect.y += 30f; if (toShow == ToShow.World) { if (wsFieldValues == null) { wsFieldValues = WorldSettings.GetFieldValues(); } WorldSettings.DoWindowContents(rect, wsFieldValues); } else if (toShow == ToShow.Map) { if (msFieldValues == null) { msFieldValues = MapSettings.GetFieldValues(); } MapSettings.DoWindowContents(rect, msFieldValues); } else if (toShow == ToShow.CurrentGame) { if (cgFieldValues == null) { cgFieldValues = CurrentSettings.GetFieldValues(); } CurrentSettings.DoWindowContents(rect, cgFieldValues); } }
public static void Update() { if (applied) { return; } applied = true; LumpsApplied = false; //Enable = true; //EnableMountainSettings = true; MapSettings.Initialize(); var animalMultiplier = (WorldComp.AnimalMultiplier < 0) ? MapSettings.AnimalDensity.GetMultiplier() : WorldComp.AnimalMultiplier; var plantMultiplier = (WorldComp.PlantMultiplier < 0) ? MapSettings.PlantDensity.GetMultiplier() : WorldComp.PlantMultiplier; StringBuilder sb = new StringBuilder(); sb.AppendLine("[Configurable Maps] Using Map Settings:"); // Biome BiomeDefs.Clear(); foreach (BiomeDef def in DefDatabase <BiomeDef> .AllDefs) { try { BiomeDefs.Add(new Pair <BiomeDef, BiomeOriginalValues>(def, new BiomeOriginalValues(def.animalDensity, def.plantDensity))); def.animalDensity *= animalMultiplier; def.plantDensity *= plantMultiplier; } catch { Log.Error("[Configurable Maps] failed to update biome " + def.defName); } } Scatterers.Clear(); // Ruins UpdateGenStepScatterer("ScatterRuinsSimple", MapSettings.Ruins, Scatterers, sb); // Shrines UpdateGenStepScatterer("ScatterShrines", MapSettings.Shrines, Scatterers, sb); // SteamGeysers UpdateGenStepScatterer("SteamGeysers", MapSettings.Geysers, Scatterers, sb); // AncientPipelineSection UpdateGenStepScatterer("AncientPipelineSection", MapSettings.AncientPipelineSection, Scatterers, sb); // AncientJunkClusters UpdateGenStepScatterer("AncientJunkClusters", MapSettings.AncientJunkClusters, Scatterers, sb); var l = (DefDatabase <GenStepDef> .GetNamed("PreciousLump").genStep as GenStep_ScatterLumpsMineable); l.count = 100; // Minable foreach (var m in MapSettings.Mineables) { UpdateMineable(m, Mineability, sb); } /*if (ModsConfig.IdeologyActive) * { * sb.AppendLine("Ancient Map Things (will only see these once ever time the game is loaded)"); * foreach (var d in DefDatabase<MapGeneratorDef>.AllDefs) * { * d.genSteps?.RemoveAll(gs => * { * if (!MapSettings.EnableAncientUtilBuildings && gs.defName == "AncientUtilityBuilding") * { * sb.AppendLine("- disabled AncientUtilityBuilding"); * return true; * } * if (!MapSettings.EnableAncientMechanoidRemains && gs.defName == "MechanoidRemains") * { * sb.AppendLine("- disabled MechanoidRemains"); * return true; * } * if (!MapSettings.EnableAncientTurrets && gs.defName == "AncientTurret") * { * sb.AppendLine("- disabled AncientTurret"); * return true; * } * if (!MapSettings.EnableAncientMechs && gs.defName == "AncientMechs") * { * sb.AppendLine("- disabled AncientMechs"); * return true; * } * if (!MapSettings.EnableAncientLandingPad && gs.defName == "AncientLandingPad") * { * sb.AppendLine("- disabled AncientLandingPad"); * return true; * } * if (!MapSettings.EnableAncientFences && gs.defName == "AncientFences") * { * sb.AppendLine("- disabled AncientFences"); * return true; * } * return false; * }); * } * }*/ Log.Message(sb.ToString()); }