public static void RegisterGenerators() { string[] names = Enum.GetNames(typeof(MapGenBiome)); string desc = "%HSeed specifies biome of the map. " + "It must be one of the following: &f" + names.Join(); foreach (MapGenTheme theme in Enum.GetValues(typeof(MapGenTheme))) { MapGen.Register(theme.ToString(), GenType.fCraft, (p, lvl, seed) => Gen(p, lvl, seed, theme), desc); } }
public static void RegisterGenerators() { const GenType type = GenType.Advanced; MapGen.Register("Billow", type, GenBillow2D, defHelp); MapGen.Register("RidgedMultifractal", type, GenRidged2D, defHelp); MapGen.Register("Perlin", type, GenPerlin2D, defHelp); MapGen.Register("Checkerboard", type, GenCheckerboard, "&HSeed does nothing"); MapGen.Register("Voronoi", type, GenVoronoi, defHelp); MapGen.Register("Perlin3D", type, GenPerlin3D, defHelp); MapGen.Register("Perlin3Dyadjust", type, GenPerlin3DYAdjust, defHelp); MapGen.Register("Billow3D", type, GenBillow3D, defHelp); }
public static void RegisterGenerators() { const GenType type = GenType.Simple; MapGen.Register("Island", type, GenIsland, defHelp); MapGen.Register("Mountains", type, GenMountains, defHelp); MapGen.Register("Forest", type, GenForest, defHelp); MapGen.Register("Ocean", type, GenOcean, defHelp); MapGen.Register("Flat", type, GenFlat, "&HSeed specifies grass height (default half of level height)"); MapGen.Register("Pixel", type, GenPixel, "&HSeed does nothing"); MapGen.Register("Empty", type, GenEmpty, "&HSeed does nothing"); MapGen.Register("Desert", type, GenDesert, defHelp); MapGen.Register("Space", type, GenSpace, defHelp); MapGen.Register("Rainbow", type, GenRainbow, defHelp); MapGen.Register("Hell", type, GenHell, defHelp); }
public static void RegisterGenerators() { string[] names = Enum.GetNames(typeof(MapGenBiome)); string desc = "%HSeed specifies biome of the map. " + "It must be one of the following: &f" + names.Join(); for (MapGenTheme theme = 0; theme < MapGenTheme.Count; theme++) { // Because of the way C# implements for loop closures, '=> Gen(p, lvl, seed, theme_)' // captures the variable from the LAST iteration, not the current one // Hence this causes an error to get thrown later, because 'Gen' is always executed // with 'MapGenTheme.Count' theme instead of the expected theme // Using a local variable copy fixes this MapGenTheme theme_ = theme; MapGen.Register(theme_.ToString(), GenType.fCraft, (p, lvl, seed) => Gen(p, lvl, seed, theme_), desc); } }