Exemplo n.º 1
0
        public void PlaceVolcano(int x, int y)
        {
            //some notes:
            //It is the same on every worldsize. This will be fixed.
            //It doesn't merge with the ground well AT ALL. This will also be fixed.
            //The elevation is kinda f****d.
            //Most of the values are arbituary.
            //The code does need to be cleaned up. I'll do that in the final version.
            //Most of the methods I use are in WorldMethods. Its a file i copypaste in any worldgen project I do, so it may have some unused methods.


            //basic land of the area.

            for (int depth = 0; depth < 100; depth++)
            {
                if (Main.rand.Next(6) == 1)
                {
                    WorldMethods.TileRunner(x, y + depth, (double)125 + Main.rand.Next(75), 1, mod.TileType("VolcanoTile"), false, 0f, 0f, true, true);             //improve basic shape later
                }
            }

            //random bits of lava above ground, that fall. Despite not being the "prettiest" method, it probably looks and works the best.
            for (int r = 0; r < 250; r++)
            {
                Tile tile = Main.tile[x + Main.rand.Next(-75, 75), y - Main.rand.Next(10, 85)];
                tile.liquid = 255;
                tile.lava(true);
            }
            //A line of consecutive "spikes" along the ground.
            for (int k = x - 85; k < x + 85; k++)
            {
                WorldMethods.CragSpike(k, (int)(y - Main.rand.Next(10, 28)), 1, 30, (ushort)mod.TileType("VolcanoStone"), (float)Main.rand.Next(2, 6), (float)Main.rand.Next(2, 6));
            }

            //the main volcano
            WorldMethods.MainVolcano(x, (int)(y - Main.rand.Next(70, 90)), 3, 130, (ushort)mod.TileType("VolcanoStone"), (float)(Main.rand.Next(400, 600) / 100), (float)(Main.rand.Next(400, 600) / 100));

            //digs the tunnel down the middle
            for (int j = y - 100; j < y + 20; j++)
            {
                WorldGen.digTunnel(x, j, 0, 0, 8, (int)(5 + (Math.Sqrt((j + 100) - y) / 1.5f)), false);
            }
            //giant gaping hole you see at the bottom.
            WorldMethods.RoundHole(x, y + 30, 17, 7, 10, true);

            //more random lava bits.
            for (int r = 0; r < 2000; r++)
            {
                Tile tile = Main.tile[x + Main.rand.Next(-30, 30), y + Main.rand.Next(-20, 45)];
                tile.liquid = 255;
                tile.lava(true);
            }

            //generates the ore
            for (int OreGen = 0; OreGen < 100; OreGen++)
            {
                int orex = x + Main.rand.Next(-75, 75);
                int orey = y + Main.rand.Next(-20, 300);
                if (Main.tile[orex, orey].type == mod.TileType("VolcanoStone"))
                {
                    WorldGen.TileRunner(orex, orey, (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(3, 6), mod.TileType("MoltenOre"), false, 0f, 0f, false, true);
                }                                                          // A = x, B = y.
            }

            //Turns nearby water into lava.
            for (int LiquidX = -110; LiquidX < 110; LiquidX++)
            {
                for (int LiquidY = -20; LiquidY < 150; LiquidY++)
                {
                    Tile tile = Main.tile[x + LiquidX, y + LiquidY];
                    if (tile.liquid > 0)
                    {
                        tile.lava(true);
                    }
                }
            }
        }