Esempio n. 1
0
        public static void StructureGen(int xPosO, int yPosO, bool mirrored)
        {
            //Steam Heart

            /**
             * 0 = Do Nothing
             * 1 = Steam chest
             * 2 = Steam Brick
             * 3 = Platforms
             * 4 = Lava
             * 5 = lavafall
             * 6 = wooden crate
             * 9 = Kill tile
             * */


            for (int i = 0; i < _structureArray.GetLength(1); i++)
            {
                for (int j = 0; j < _structureArray.GetLength(0); j++)
                {
                    if (mirrored)
                    {
                        if (TileCheckSafe((int)(xPosO + _structureArray.GetLength(1) - i), (int)(yPosO + j)))
                        {
                            if (_structureArray[j, i] == 1)
                            {
                                MoToolsWorld.PlaceSteamChest(xPosO + _structureArray.GetLength(1) - i, yPosO + j, (ushort)ModContent.TileType <SteamBrick>());
                            }
                            if (_structureArray[j, i] == 2)
                            {
                                WorldGen.KillTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j);
                                WorldGen.PlaceTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j, ModContent.TileType <SteamBrick>(), true, true);
                            }
                            if (_structureArray[j, i] == 3)
                            {
                                WorldGen.KillTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j);
                                WorldGen.PlaceTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j, 19, true, true, -1, 13);
                            }
                            if (_structureArray[j, i] == 4)
                            {
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                                Main.tile[xPosO + _structureArray.GetLength(1) - i, yPosO + j].lava(true);
                                Main.tile[xPosO + _structureArray.GetLength(1) - i, yPosO + j].liquid = 255;
                            }
                            if (_structureArray[j, i] == 5)
                            {
                                WorldGen.KillTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j);
                                WorldGen.KillWall(xPosO + _structureArray.GetLength(1) - i, yPosO + j);
                                WorldGen.PlaceWall(xPosO + _structureArray.GetLength(1) - i, yPosO + j, 137, true); //Lavafall Wall
                            }
                            if (_structureArray[j, i] == 6)
                            {
                                WorldGen.KillTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j);
                                WorldGen.KillTile(xPosO + _structureArray.GetLength(1) - i + 1, yPosO + j);
                                WorldGen.KillTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j - 1);
                                WorldGen.KillTile(xPosO + _structureArray.GetLength(1) - i + 1, yPosO + j - 1);
                                Terraria.WorldGen.PlaceObject(xPosO + _structureArray.GetLength(1) - i, yPosO + j, 376, true, 0, -1, -1);
                            }
                            if (_structureArray[j, i] == 7)
                            {
                                Main.tile[xPosO + _structureArray.GetLength(1) - i, yPosO + j].liquid = 0;
                                WorldGen.KillTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j);
                            }
                        }
                    }
                    else
                    {
                        if (TileCheckSafe((int)(xPosO + i), (int)(yPosO + j)))
                        {
                            if (_structureArray[j, i] == 1)
                            {
                                MoToolsWorld.PlaceSteamChest(xPosO + i, yPosO + j, (ushort)ModContent.TileType <SteamBrick>());
                            }
                            if (_structureArray[j, i] == 2)
                            {
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                                WorldGen.PlaceTile(xPosO + i, yPosO + j, ModContent.TileType <SteamBrick>(), true, true);
                            }
                            if (_structureArray[j, i] == 3)
                            {
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                                WorldGen.PlaceTile(xPosO + i, yPosO + j, 19, true, true, -1, 13);
                            }
                            if (_structureArray[j, i] == 4)
                            {
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                                Main.tile[xPosO + i, yPosO + j].lava(true);
                                Main.tile[xPosO + i, yPosO + j].liquid = 255;
                            }
                            if (_structureArray[j, i] == 5)
                            {
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                                WorldGen.KillWall(xPosO + i, yPosO + j);
                                WorldGen.PlaceWall(xPosO + i, yPosO + j, 137, true); //Lavafall Wall
                            }
                            if (_structureArray[j, i] == 6)
                            {
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                                WorldGen.KillTile(xPosO + i + 1, yPosO + j);
                                WorldGen.KillTile(xPosO + i, yPosO + j - 1);
                                WorldGen.KillTile(xPosO + i + 1, yPosO + j - 1);
                                Terraria.WorldGen.PlaceObject(xPosO + i, yPosO + j, 376, true, 0, -1, -1);
                            }
                            if (_structureArray[j, i] == 7)
                            {
                                Main.tile[xPosO + i, yPosO + j].liquid = 0;
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
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);
                MoToolsWorld.PlaceSteamChest(x + chestPos, y + height - 2, (ushort)ModContent.TileType <SteamBrick>());
            }
            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 <SteamBedTile>());
                    }
                    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 <SteamDresserTile>());
                        }
                        else
                        {
                            WorldGen.PlaceObject(x + i + 1, y + height - 2, ModContent.TileType <SteamTableTile>());
                            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)
                        {
                            MoToolsWorld.PlaceSteamChest(x + Main.rand.Next(2, width - 4), y + height - 2, (ushort)ModContent.TileType <SteamBrick>());
                        }
                        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 <SteamSinkTile>());
                        }
                        else
                        {
                            WorldGen.PlaceObject(x + i, y + height - 2, ModContent.TileType <SteamWorkbenchTile>());
                            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>());
                        }
                    }
                }
            }
        }