コード例 #1
0
ファイル: Regen.cs プロジェクト: Illuminousity/WorldRefill
        public static Task AsyncGenLifeCrystals(short amount)
        {
            WorldRefill.isTaskRunning = true;
            int tryX      = WorldGen.genRand.Next(1, Main.maxTilesX);
            int tryY      = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.UnderworldLayer + 100));
            int realcount = 0;

            return(Task.Run(() =>
            {
                for (int trycount = 0; trycount < WorldRefill.config.GenerationMaxTries; trycount++)
                {
                    if (!WorldRefill.IsProtected(tryX, tryY))
                    {
                        if (WorldGen.AddLifeCrystal(tryX, tryY))
                        {
                            realcount++;
                            //Determine if enough Objects have been generated
                            if (realcount == amount)
                            {
                                break;
                            }
                        }
                    }
                }

                WorldRefill.realcount = realcount;
            }).ContinueWith((d) => FinishGen()));
        }
コード例 #2
0
 public override void RandomUpdate(int i, int j)
 {
     if (Main.tile[i, j - 1].type == 0 && Main.tile[i + 1, j - 1].type == 0 && Main.tile[i, j - 2].type == 0 && Main.tile[i + 1, j - 2].type == 0 && Main.tile[i, j].active())
     {
         if (Main.rand.Next(20) == 0)
         {
             if (CountCrystals(i, j) < 9)
             {
                 WorldGen.AddLifeCrystal(i, j - 1);
             }
         }
     }
 }
コード例 #3
0
    private void LifeCrystals(GenerationProgress progress, GameConfiguration configuration)
    {
        progress.Message = "Adding even more life crystals";

        var amount = 100;

        for (int n = 0; n < amount; n++)
        {
            for (var k = 0; k < (int)(Main.maxTilesX * Main.maxTilesY * 6E-05); k++)
            {
                var x = WorldGen.genRand.Next(50, Main.maxTilesX - 50);
                var y = WorldGen.genRand.Next((int)WorldGen.rockLayerLow, Main.maxTilesY);
                WorldGen.AddLifeCrystal(x, y);
            }
        }
    }
コード例 #4
0
        public static Task AsyncGenLifeCrystals(short amount, int maxtries = Config.GenerationMaxTries)
        {
            WorldRefill.isTaskRunning = true;
            int realcount = 0;

            return(Task.Run(() =>
            {
                for (int trycount = 0; trycount <= maxtries; trycount++)
                {
                    if (WorldGen.AddLifeCrystal(WorldGen.genRand.Next(1, Main.maxTilesX), WorldGen.genRand.Next((int)(Main.rockLayer), (int)(MainExt.UnderworldLayer + 100))))
                    {
                        realcount++;
                        //Determine if enough Objects have been generated
                        if (realcount == amount)
                        {
                            break;
                        }
                    }
                }
                WorldRefill.realcount = realcount;
            }).ContinueWith((d) => { WorldRefill.isTaskRunning = false; }));
        }
コード例 #5
0
ファイル: WorldRefill.cs プロジェクト: VLOBE/WorldRefill
        private void DoCrystals(CommandArgs args)
        {
            if (args.Parameters.Count == 1)
            {
                var mCry     = Int32.Parse(args.Parameters[0]);
                var surface  = Main.worldSurface;
                var trycount = 0;
                //maxtries = retry amounts if generation of object fails
                const int maxtries = 1000000;
                //realcount = actual amount of objects generated
                var realcount = 0;

                //Attempting to generate Objects
                while (trycount < maxtries)
                {
                    if (WorldGen.AddLifeCrystal(WorldGen.genRand.Next(1, Main.maxTilesX), WorldGen.genRand.Next((int)(surface + 20.0), Main.maxTilesY)))
                    {
                        realcount++;
                        //Determine if enough Objects have been generated
                        if (realcount == mCry)
                        {
                            break;
                        }
                    }
                    trycount++;
                }
                //Notify user on success
                args.Player.SendSuccessMessage("Generated and hid {0} Life Crystals.", realcount);

                InformPlayers();
            }
            else
            {
                //notify user of command failure
                args.Player.SendInfoMessage("Usage: /gencrystals (number of crystals to generate)");
            }
        }
コード例 #6
0
        private bool PrivateReplenisher(GenType type, int amount, ushort oretype = 0, CommandArgs args = null)
        {
            int  counter = 0;
            bool success;

            for (int i = 0; i < TIMEOUT; i++)
            {
                success = false;
                int xRandBase = WorldGen.genRand.Next(1, Main.maxTilesX);
                int y         = 0;
                switch (type)
                {
                case GenType.ore:
                    y = WorldGen.genRand.Next((int)(Main.worldSurface) - 12, Main.maxTilesY);
                    if (TShock.Regions.InAreaRegion(xRandBase, y).Any() && !config.GenerateInProtectedAreas)
                    {
                        success = false;
                        break;
                    }
                    if (oretype != Terraria.ID.TileID.Hellstone)
                    {
                        WorldGen.OreRunner(xRandBase, y, 2.0, amount, oretype);
                    }
                    else
                    {
                        WorldGen.OreRunner(xRandBase, WorldGen.genRand.Next((int)(Main.maxTilesY) - 200, Main.maxTilesY), 2.0, amount, oretype);
                    }
                    success = true;
                    break;

                case GenType.chests:
                    if (amount == 0)
                    {
                        int tmpEmpty = 0, empty = 0;
                        for (int x = 0; x < 1000; x++)
                        {
                            if (Main.chest[x] != null)
                            {
                                tmpEmpty++;
                                bool found = false;
                                foreach (Item itm in Main.chest[x].item)
                                {
                                    if (itm.netID != 0)
                                    {
                                        found = true;
                                    }
                                }
                                if (found == false)
                                {
                                    empty++;
                                    WorldGen.KillTile(Main.chest[x].x, Main.chest[x].y, false, false, false);
                                    Main.chest[x] = null;
                                }
                            }
                        }
                        args.Player.SendSuccessMessage("Uprooted {0} empty out of {1} chests.", empty, tmpEmpty);
                        return(true);
                    }
                    y = WorldGen.genRand.Next((int)(Main.worldSurface) - 200, Main.maxTilesY);
                    if (TShock.Regions.InAreaRegion(xRandBase, y).Any() && !config.GenerateInProtectedAreas)
                    {
                        success = false;
                        break;
                    }
                    success = WorldGen.AddBuriedChest(xRandBase, y);
                    break;

                case GenType.pots:
                    y = WorldGen.genRand.Next((int)(Main.worldSurface) - 12, Main.maxTilesY);
                    if (TShock.Regions.InAreaRegion(xRandBase, y).Any() && !config.GenerateInProtectedAreas)
                    {
                        success = false;
                        break;
                    }
                    success = WorldGen.PlacePot(xRandBase, y);
                    break;

                case GenType.lifecrystals:
                    y = WorldGen.genRand.Next((int)(Main.worldSurface) - 12, Main.maxTilesY);
                    if (TShock.Regions.InAreaRegion(xRandBase, y).Any() && !config.GenerateInProtectedAreas)
                    {
                        success = false;
                        break;
                    }
                    success = WorldGen.AddLifeCrystal(xRandBase, y);
                    break;

                case GenType.altars:
                    y = WorldGen.genRand.Next((int)(Main.worldSurface) - 12, Main.maxTilesY);
                    if (TShock.Regions.InAreaRegion(xRandBase, y).Any() && !config.GenerateInProtectedAreas)
                    {
                        success = false;
                        break;
                    }
                    WorldGen.Place3x2(xRandBase, y, 26);
                    success = Main.tile[xRandBase, y].type == 26;
                    break;

                case GenType.trees:
                    WorldGen.AddTrees();
                    success = true;
                    break;

                case GenType.floatingisland:
                    y = WorldGen.genRand.Next((int)Main.worldSurface + 175, (int)Main.worldSurface + 300);
                    if (TShock.Regions.InAreaRegion(xRandBase, y).Any() && !config.GenerateInProtectedAreas)
                    {
                        success = false;
                        break;
                    }
                    WorldGen.FloatingIsland(xRandBase, y);
                    success = true;
                    break;

                case GenType.pyramids:
                    //TODO
                    break;
                }
                if (success)
                {
                    counter++;
                    if (counter >= amount)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
コード例 #7
0
        public void PlaceCrystalForest(int x, int y)
        {
            //initial pit
            WorldMethods.TileRunner(x, y, (double)150, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, true, true); //improve basic shape later
            bool leftpit = false;
            int  PitX;
            int  PitY;

            if (Main.rand.Next(2) == 0)
            {
                leftpit = true;
            }
            if (leftpit)
            {
                PitX = x - Main.rand.Next(5, 15);
            }
            else
            {
                PitX = x + Main.rand.Next(5, 15);
            }
            for (PitY = y - 16; PitY < y + 25; PitY++)
            {
                WorldGen.digTunnel(PitX, PitY, 0, 0, 1, 4, false);
                WorldGen.TileRunner(PitX, PitY, 11, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, false, true);
            }
            //tunnel off of pit
            int tunnellength = Main.rand.Next(50, 110);
            int TunnelEndX   = 0;

            if (leftpit)
            {
                for (int TunnelX = PitX; TunnelX < PitX + tunnellength; TunnelX++)
                {
                    WorldGen.digTunnel(TunnelX, PitY, 0, 0, 1, 4, false);
                    WorldGen.TileRunner(TunnelX, PitY, 13, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, false, true);
                    TunnelEndX = TunnelX;
                }
            }
            else
            {
                for (int TunnelX = PitX; TunnelX > PitX - tunnellength; TunnelX--)
                {
                    WorldGen.digTunnel(TunnelX, PitY, 0, 0, 1, 4, false);
                    WorldGen.TileRunner(TunnelX, PitY, 13, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, false, true);
                    TunnelEndX = TunnelX;
                }
            }
            //More pits and spikes
            int TrapX;

            for (int TrapNum = 0; TrapNum < 10; TrapNum++)
            {
                if (leftpit)
                {
                    TrapX = Main.rand.Next(PitX, PitX + tunnellength);
                }
                else
                {
                    TrapX = Main.rand.Next(PitX - tunnellength, PitX);
                }
                for (int TrapY = PitY; TrapY < PitY + 15; TrapY++)
                {
                    WorldGen.digTunnel(TrapX, TrapY, 0, 0, 1, 3, false);
                    WorldGen.TileRunner(TrapX, TrapY, 11, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, false, true);
                }
                WorldGen.TileRunner(TrapX, PitY + 18, 9, 1, 48, false, 0f, 0f, false, true);
            }
            //Additional hole and tunnel
            int PittwoY = 0;

            for (PittwoY = PitY; PittwoY < PitY + 40; PittwoY++)
            {
                WorldGen.digTunnel(TunnelEndX, PittwoY, 0, 0, 1, 4, false);
                WorldGen.TileRunner(TunnelEndX, PittwoY, 11, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, false, true);
            }
            int PittwoX = 0;

            for (PittwoX = TunnelEndX - 50; PittwoX < TunnelEndX + 50; PittwoX++)
            {
                WorldGen.digTunnel(PittwoX, PittwoY, 0, 0, 1, 4, false);
                WorldGen.TileRunner(PittwoX, PittwoY, 13, 1, mod.TileType("ReachGrassTile"), false, 0f, 0f, false, true);
                WorldGen.PlaceChest(PittwoX, PittwoY, 21, false, 2);
                WorldGen.PlaceChest(PittwoX + 5, PittwoY + 3, 21, false, 2);
                WorldGen.PlaceChest(PittwoX + 1, PittwoY + 2, 21, false, 2);
            }
            //grass walls
            for (int wallx = x - 100; wallx < x + 100; wallx++)
            {
                for (int wally = y - 25; wally < y + 100; wally++)
                {
                    if (Main.tile[wallx, wally].wall != 0)
                    {
                        WorldGen.KillWall(wallx, wally);
                        WorldGen.PlaceWall(wallx, wally, 63);
                    }
                }
            }
            //campfires and shit
            int  SkullStickY = 0;
            Tile tile        = Main.tile[1, 1];

            for (int SkullStickX = x - 90; SkullStickX < x + 90; SkullStickX++)
            {
                if (Main.rand.Next(4) == 1)
                {
                    for (SkullStickY = y - 80; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0)
                        {
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 2, 215);//i dont know which of these is correct but i cant be bothered to test.
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 1, 215);
                            WorldGen.PlaceObject(SkullStickX, SkullStickY, 215);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 2, 215, 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 1, 215, 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY, 215, 0, 0, -1, -1);
                        }
                    }
                }
                if (Main.rand.Next(9) == 1)
                {
                    for (SkullStickY = y - 60; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0 || tile.type == mod.TileType("ReachGrassTile"))
                        {
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 3, mod.TileType("SkullStick")); //i dont know which of these is correct but i cant be bothered to test.
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 2, mod.TileType("SkullStick"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 1, mod.TileType("SkullStick"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY, mod.TileType("SkullStick"));
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 3, mod.TileType("SkullStick"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 2, mod.TileType("SkullStick"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 1, mod.TileType("SkullStick"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY, mod.TileType("SkullStick"), 0, 0, -1, -1);
                        }
                    }
                }
                if (Main.rand.Next(12) == 1)
                {
                    for (SkullStickY = y - 60; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0 || tile.type == mod.TileType("ReachGrassTile"))
                        {
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 3, mod.TileType("SkullStick2")); //i dont know which of these is correct but i cant be bothered to test.
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 2, mod.TileType("SkullStick2"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 1, mod.TileType("SkullStick2"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY, mod.TileType("SkullStick2"));
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 3, mod.TileType("SkullStick2"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 2, mod.TileType("SkullStick2"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 1, mod.TileType("SkullStick2"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY, mod.TileType("SkullStick2"), 0, 0, -1, -1);
                        }
                    }
                }
                if (Main.rand.Next(10) == 1)
                {
                    for (SkullStickY = y - 60; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0 || tile.type == mod.TileType("ReachGrassTile"))
                        {
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 3, mod.TileType("SkullStick3")); //i dont know which of these is correct but i cant be bothered to test.
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 2, mod.TileType("SkullStick3"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 1, mod.TileType("SkullStick3"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY, mod.TileType("SkullStick3"));
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 3, mod.TileType("SkullStick3"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 2, mod.TileType("SkullStick3"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 1, mod.TileType("SkullStick3"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY, mod.TileType("SkullStick3"), 0, 0, -1, -1);
                        }
                    }
                }
                if (Main.rand.Next(25) == 1)
                {
                    for (SkullStickY = y - 60; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0 || tile.type == mod.TileType("ReachGrassTile"))
                        {
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 3, mod.TileType("CreationAltarTile")); //i dont know which of these is correct but i cant be bothered to test.
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 2, mod.TileType("CreationAltarTile"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 1, mod.TileType("CreationAltarTile"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY, mod.TileType("CreationAltarTile"));
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 3, mod.TileType("CreationAltarTile"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 2, mod.TileType("CreationAltarTile"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 1, mod.TileType("CreationAltarTile"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY, mod.TileType("CreationAltarTile"), 0, 0, -1, -1);
                        }
                    }
                }
                if (Main.rand.Next(10) == 1)
                {
                    for (SkullStickY = y - 60; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0 || tile.type == mod.TileType("ReachGrassTile"))
                        {
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 3, mod.TileType("ReachGrass1")); //i dont know which of these is correct but i cant be bothered to test.
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 2, mod.TileType("ReachGrass1"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY - 1, mod.TileType("ReachGrass1"));
                            WorldGen.PlaceObject(SkullStickX, SkullStickY, mod.TileType("ReachGrass1"));
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 3, mod.TileType("ReachGrass1"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 2, mod.TileType("ReachGrass1"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY - 1, mod.TileType("ReachGrass1"), 0, 0, -1, -1);
                            NetMessage.SendObjectPlacment(-1, SkullStickX, SkullStickY, mod.TileType("ReachGrass1"), 0, 0, -1, -1);
                        }
                    }
                }
                if (Main.rand.Next(16) == 1)
                {
                    for (SkullStickY = y - 60; SkullStickY < y + 75; SkullStickY++)
                    {
                        tile = Main.tile[SkullStickX, SkullStickY];
                        if (tile.type == 2 || tile.type == 1 || tile.type == 0 || tile.type == mod.TileType("ReachGrassTile"))
                        {
                            WorldGen.PlaceChest(SkullStickX, SkullStickY - 3, (ushort)mod.TileType("ReachChest"), false, 0);
                            WorldGen.PlaceChest(SkullStickX, SkullStickY - 2, (ushort)mod.TileType("ReachChest"), false, 0);
                            WorldGen.PlaceChest(SkullStickX, SkullStickY - 1, (ushort)mod.TileType("ReachChest"), false, 0);
                        }
                    }
                }
            }
            //loot placement
            for (PittwoX = TunnelEndX - 20; PittwoX < TunnelEndX + 20; PittwoX++)
            {
                if (Main.rand.Next(30) == 1)
                {
                    Main.tile[PittwoX, PittwoY + 1].active(true);
                    Main.tile[PittwoX + 1, PittwoY + 1].active(true);
                    Main.tile[PittwoX, PittwoY + 1].type     = 1;
                    Main.tile[PittwoX + 1, PittwoY + 1].type = 1;
                    WorldGen.AddLifeCrystal(PittwoX + 1, PittwoY);
                    WorldGen.AddLifeCrystal(PittwoX + 1, PittwoY + 1);
                    break;
                }
            }
            for (int trees = 0; trees < 5000; trees++)
            {
                int E = x + Main.rand.Next(-200, 200);
                int F = y + Main.rand.Next(-30, 30);
                tile = Framing.GetTileSafely(E, F);
                if (tile.type == mod.TileType("ReachGrassTile"))
                {
                    WorldGen.GrowTree(E, F);
                }
            }
        }
コード例 #8
0
        private static void Furnish(int height, int width)
        {
            if (numRooms == 1 || Main.rand.Next(20) == 0)
            {
                int chestPos = Main.rand.Next(2, width - 4);
                WorldGen.KillTile(x + chestPos, y + height - 2);
                WorldGen.KillTile(x + chestPos + 1, y + height - 2);
                WorldGen.KillTile(x + chestPos, y + height - 3);
                WorldGen.KillTile(x + chestPos + 1, y + height - 3);
                LaugicalityWorld.PlaceObsidiumChest(x + chestPos, y + height - 2, (ushort)ModContent.TileType <ObsidiumBrick>());
            }
            for (int i = 2; i < width - 4; i++)
            {
                if (TileCheckSafe(x + i, y + height - 2))
                {
                    if (Main.tile[x + i, y + height - 2].type == 0 && Main.tile[x + i + 1, y + height - 2].type == 0 && Main.tile[x + i + 2, y + height - 2].type == 0 && Main.tile[x + i + 3, y + height - 2].type == 0 && Main.rand.Next(width) == 0)
                    {
                        WorldGen.KillTile(x + i, y + height - 2);
                        WorldGen.KillTile(x + i + 1, y + height - 2);
                        WorldGen.KillTile(x + i + 2, y + height - 2);
                        WorldGen.KillTile(x + i + 3, y + height - 2);
                        WorldGen.KillTile(x + i, y + height - 3);
                        WorldGen.KillTile(x + i + 1, y + height - 3);
                        WorldGen.KillTile(x + i + 2, y + height - 3);
                        WorldGen.KillTile(x + i + 3, y + height - 3);

                        WorldGen.PlaceObject(x + i + 1, y + height - 2, ModContent.TileType <ObsidiumBedTile>());
                    }
                    else if (Main.tile[x + i, y + height - 2].type == 0 && Main.tile[x + i + 1, y + height - 2].type == 0 && Main.tile[x + i + 2, y + height - 2].type == 0 && Main.rand.Next(width - 2) == 0)
                    {
                        WorldGen.KillTile(x + i, y + height - 2);
                        WorldGen.KillTile(x + i + 1, y + height - 2);
                        WorldGen.KillTile(x + i + 2, y + height - 2);
                        WorldGen.KillTile(x + i, y + height - 3);
                        WorldGen.KillTile(x + i + 1, y + height - 3);
                        WorldGen.KillTile(x + i + 2, y + height - 3);

                        if (Main.rand.Next(4) == 0)
                        {
                            WorldGen.PlaceObject(x + i + 1, y + height - 2, ModContent.TileType <ObsidiumDresserTile>());
                        }
                        else
                        {
                            WorldGen.PlaceObject(x + i + 1, y + height - 2, ModContent.TileType <ObsidiumTableTile>());
                            if (Main.tile[x + i, y + height - 4].type == 0)
                            {
                                WorldGen.PlaceObject(x + i, y + height - 4, ModContent.TileType <LavaGemCandleTile>());
                            }
                        }
                    }
                    else if (Main.tile[x + i, y + height - 2].type == 0 && Main.tile[x + i + 1, y + height - 2].type == 0 && Main.rand.Next(width - 4) == 0)
                    {
                        WorldGen.KillTile(x + i, y + height - 2);
                        WorldGen.KillTile(x + i + 1, y + height - 2);
                        WorldGen.KillTile(x + i, y + height - 3);
                        WorldGen.KillTile(x + i + 1, y + height - 3);

                        if (Main.rand.Next(width * 3) == 0)
                        {
                            LaugicalityWorld.PlaceObsidiumChest(x + Main.rand.Next(2, width - 4), y + height - 2, (ushort)ModContent.TileType <ObsidiumBrick>());
                        }
                        else if (Main.rand.Next(width * 3) == 0)
                        {
                            WorldGen.AddLifeCrystal(x + i, y + height - 2);
                        }
                        else if (Main.rand.Next(2) == 0)
                        {
                            WorldGen.PlaceObject(x + i, y + height - 2, ModContent.TileType <ObsidiumSinkTile>());
                        }
                        else
                        {
                            WorldGen.PlaceObject(x + i, y + height - 2, ModContent.TileType <ObsidiumWorkbenchTile>());
                            if (Main.tile[x + i, y + height - 3].type == 0)
                            {
                                WorldGen.PlaceObject(x + i, y + height - 3, ModContent.TileType <LavaGemCandleTile>());
                            }
                        }
                    }
                    else if (Main.tile[x + i, y + height - 2].type == 0 && Main.rand.Next(width - 6) == 0)
                    {
                        if (Main.tile[x + i, y + height - 3].type == 0 && Main.tile[x + i, y + height - 4].type == 0 && Main.rand.Next(2) == 0)
                        {
                            WorldGen.PlaceObject(x + i, y + height - 2, ModContent.TileType <LavaGemLampTile>());
                        }
                        else if (Main.tile[x + i, y + 1].type == 0 && Main.tile[x + i, y + 2].type == 0)
                        {
                            WorldGen.PlaceObject(x + i, y + 1, ModContent.TileType <LavaGemLanternTile>());
                        }
                    }
                }
            }
        }