Пример #1
0
 public fCraftMapGen(fCraftMapGenArgs generatorArgs)
 {
     args  = generatorArgs;
     rand  = new Random(args.Seed);
     noise = new Noise(args.Seed, NoiseInterpolationMode.Bicubic);
     args.ApplyTheme(this);
 }
Пример #2
0
 public fCraftMapGen(fCraftMapGenArgs generatorArgs)
 {
     if (generatorArgs == null)
     {
         throw new ArgumentNullException("generatorArgs");
     }
     args  = generatorArgs;
     rand  = new Random(args.Seed);
     noise = new Noise(args.Seed, NoiseInterpolationMode.Bicubic);
     args.ApplyTheme(this);
 }
Пример #3
0
        static bool Gen(Player p, Level lvl, string seed, MapGenTheme theme)
        {
            MapGenBiome biome = MapGenBiome.Forest;

            if (seed.Length > 0 && !CommandParser.GetEnum(p, seed, "Seed", ref biome))
            {
                return(false);
            }
            fCraftMapGenArgs args = fCraftMapGenArgs.MakeTemplate(theme);

            float ratio = lvl.Height / 96.0f;

            args.MaxHeight    = (int)Math.Round(args.MaxHeight * ratio);
            args.MaxDepth     = (int)Math.Round(args.MaxDepth * ratio);
            args.SnowAltitude = (int)Math.Round(args.SnowAltitude * ratio);

            args.Biome      = biome;
            args.AddTrees   = biome == MapGenBiome.Forest;
            args.AddWater   = biome != MapGenBiome.Desert;
            args.WaterLevel = (lvl.Height - 1) / 2;

            new fCraftMapGen(args).Generate(lvl);
            return(true);
        }