Exemplo n.º 1
0
        // Note that this item does not work in Multiplayer, but serves as a learning tool for other things.
        public override bool UseItem(Player player)
        {
            int x = (int)(player.position.X / 16);
            int y = (int)(player.position.Y / 16) + 3;

            WorldMethods.TileRunner(x, y, (double)200, 1, mod.TileType("CanyonRock"), false, 0f, 0f, true, true);             //improve basic shape later

            WorldMethods.RoundHole(x, y - 20, 60, 30, 10, true);
            for (int i = 0; i < 3; i++)
            {
                int Ex        = Main.rand.Next(-35, 35);
                int height    = Main.rand.Next(30, 80);
                int BaseWidth = Main.rand.Next(60, 80);
                int Sway      = 0;
                for (int j = 15; j < height; j++)
                {
                    if (Main.rand.Next(4) == 0)
                    {
                        if (Main.rand.Next(2) == 0)
                        {
                            Sway -= 1;
                        }
                        else
                        {
                            Sway += 1;
                        }
                    }
                    WorldMethods.TileRunner((x + Ex) + Sway, (y + 10) + j, (double)25 + (BaseWidth / Math.Sqrt(j)), 1, mod.TileType("CanyonRock"), false, 0f, 0f, true, true);                    //improve basic shape later
                    WorldGen.digTunnel((x + Ex) + Sway, (y + 10) + j, 0, 0, 3, (int)(BaseWidth / Math.Sqrt(j)), false);
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        public void PlaceCanyon(int x, int y)
        {
            int canyonRockTile = mod.TileType <Tiles.CanyonRock>();

            WorldMethods.TileRunner(x, y, (double)200, 1, mod.TileType("CanyonRock"), false, 0f, 0f, true, true); //improve basic shape later

            WorldMethods.RoundHole(x, y - 20, 60, 30, 10, true);

            for (int i = 0; i < 3; i++)
            {
                int Ex        = Main.rand.Next(-35, 35);
                int height    = Main.rand.Next(30, 80);
                int BaseWidth = Main.rand.Next(60, 80);
                int Sway      = 0;
                for (int j = 15; j < height; j++)
                {
                    if (Main.rand.Next(4) == 0)
                    {
                        if (Main.rand.Next(2) == 0)
                        {
                            Sway -= 1;
                        }
                        else
                        {
                            Sway += 1;
                        }
                    }
                    WorldMethods.TileRunner((x + Ex) + Sway, (y + 10) + j, (double)25 + (BaseWidth / Math.Sqrt(j)), 1, mod.TileType("CanyonRock"), false, 0f, 0f, true, true); //improve basic shape later
                    WorldGen.digTunnel((x + Ex) + Sway, (y + 10) + j, 0, 0, 3, (int)(BaseWidth / Math.Sqrt(j)), false);

                    /*for (int h = -10; h < 10; h++)
                     *                  {
                     *                          WorldGen.KillWall((x + Ex) + Sway + h, (y + 10) + j);
                     *
                     *                  }*/
                }
            }
        }
Exemplo n.º 3
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);
                    }
                }
            }
        }