public static void Prefix() { try { DefsUtil.Update(); } catch { Log.Error("[Configurable Maps] failed to apply map settings."); } }
public static void Prefix(MapParent parent, MapGeneratorDef mapGenerator, IEnumerable <GenStepWithParams> extraGenStepDefs) { const float MAX_MTN_VALUE = 0.7f; buMtnValue = null; buWaterValue = null; if (shouldOverrideSettings(parent, mapGenerator, extraGenStepDefs)) { buMtnValue = MapSettings.Mountain; buWaterValue = MapSettings.Water; float value = buMtnValue.GetMultiplier(); if (value > MAX_MTN_VALUE) { Log.Warning($"[Configurable Maps] For quest maps, capping mountain density to {MAX_MTN_VALUE}"); MapSettings.Mountain = new RandomizableMultiplier0(); MapSettings.Mountain.SetIsRandom(false); MapSettings.Mountain.SetMultiplier(MAX_MTN_VALUE); } value = buWaterValue.GetMultiplier(); if (value > MAX_MTN_VALUE) { Log.Warning($"[Configurable Maps] For quest maps, capping water density to {MAX_MTN_VALUE}"); MapSettings.Water = new RandomizableMultiplier0(); MapSettings.Water.SetIsRandom(false); MapSettings.Water.SetMultiplier(MAX_MTN_VALUE); } //DefsUtil.Enable = false; //Log.Message("[Configurable Maps] this tile has a quest on it. Disabling map modifications."); //DefsUtil.EnableMountainSettings = false; //Log.Message("[Configurable Maps] fertility, water, and mountain settings will be disabled for this map since it has a quest on it."); } try { DefsUtil.Update(); } catch { Log.Error("[Configurable Maps] failed to apply map settings."); } GenStep_RockChunks_GrowLowRockFormationFrom.ChunkLevel = MapSettings.ChunkLevel; if (MapSettings.ChunkLevel == ChunkLevelEnum.Random) { GenStep_RockChunks_GrowLowRockFormationFrom.ChunkLevel = (ChunkLevelEnum)Rand.RangeInclusive(0, Enum.GetNames(typeof(ChunkLevelEnum)).Length - 1); } }