internal static void AgeSnowRoom(Rectangle room)
        {
            WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new GenAction[]
            {
                new Modifiers.Dither(0.60000002384185791),
                new Modifiers.Blotches(2, 0.60000002384185791),
                new Modifiers.OnlyTiles(new ushort[]
                {
                    CaveHouseBiome.BuildData.Snow.Tile
                }),
                new Actions.SetTile(161, true, true),
                new Modifiers.Dither(0.8),
                new Actions.SetTile(147, true, true)
            }));
            WorldUtils.Gen(new Point(room.X + 1, room.Y), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new GenAction[]
            {
                new Modifiers.Dither(0.5),
                new Modifiers.OnlyTiles(new ushort[]
                {
                    161
                }),
                new Modifiers.Offset(0, 1),
                new ActionStalagtite()
            }));
            WorldUtils.Gen(new Point(room.X + 1, room.Y + room.Height - 1), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new GenAction[]
            {
                new Modifiers.Dither(0.5),
                new Modifiers.OnlyTiles(new ushort[]
                {
                    161
                }),
                new Modifiers.Offset(0, 1),
                new ActionStalagtite()
            }));

            GenAction action;

            if ((double)room.Y > Main.worldSurface)
            {
                action = new Actions.ClearWall(true);
            }
            else
            {
                action = new Actions.PlaceWall(40, true);
            }

            WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new GenAction[]
            {
                new Modifiers.Dither(0.85000002384185791),
                new Modifiers.Blotches(2, 0.8),
                action
            }));
        }
        internal static void AgeDefaultRoom(Rectangle room)
        {
            for (int i = 0; i < room.Width * room.Height / 16; i++)
            {
                int num  = GenBase._random.Next(1, room.Width - 1) + room.X;
                int num2 = GenBase._random.Next(1, room.Height - 1) + room.Y;
                WorldUtils.Gen(new Point(num, num2), new Shapes.Rectangle(2, 2), Actions.Chain(new GenAction[]
                {
                    new Modifiers.Dither(0.5),
                    new Modifiers.Blotches(2, 2.0),
                    new Modifiers.IsEmpty(),
                    new Actions.SetTile(51, true, true)
                }));
            }

            GenAction action;

            if ((double)room.Y > Main.worldSurface)
            {
                action = new Actions.ClearWall(true);
            }
            else
            {
                action = new Actions.PlaceWall(2, true);
            }

            WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new GenAction[]
            {
                new Modifiers.Dither(0.85000002384185791),
                new Modifiers.Blotches(2, 0.3),
                new Modifiers.OnlyWalls(new byte[]
                {
                    CaveHouseBiome.BuildData.Default.Wall
                }),
                action
            }));
            WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new GenAction[]
            {
                new Modifiers.Dither(0.949999988079071),
                new Modifiers.OnlyTiles(new ushort[]
                {
                    30,
                    321,
                    158
                }),
                new Actions.ClearTile(true)
            }));
        }
        public override bool Place(Point origin, StructureMap structures)
        {
            Point     point;
            Ref <int> @ref = new Ref <int>(0);
            Ref <int> ref1 = new Ref <int>(0);

            Shapes.Circle circle  = new Shapes.Circle(10);
            GenAction[]   scanner = new GenAction[] { new Actions.Scanner(ref1), new Modifiers.IsSolid(), new Actions.Scanner(@ref) };
            WorldUtils.Gen(origin, circle, Actions.Chain(scanner));
            if (@ref.Value < ref1.Value - 5)
            {
                return(false);
            }
            int num  = GenBase._random.Next(6, 10);
            int num1 = GenBase._random.Next(5);

            if (!structures.CanPlace(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 0))
            {
                return(false);
            }
            ShapeData shapeDatum = new ShapeData();

            Shapes.Slime slime    = new Shapes.Slime(num);
            GenAction[]  onlyTile = new GenAction[] { (new Modifiers.Blotches(num1, num1, num1, 1, 0.3)).Output(shapeDatum), new Modifiers.Offset(0, -2), null, null, null, null };
            ushort[]     numArray = new ushort[] { 53 };
            onlyTile[2] = new Modifiers.OnlyTiles(numArray);
            onlyTile[3] = new Actions.SetTile(397, true, true);
            onlyTile[4] = new Modifiers.OnlyWalls(new byte[1]);
            onlyTile[5] = new Actions.PlaceWall(16, true);
            WorldUtils.Gen(origin, slime, Actions.Chain(onlyTile));
            ModShapes.All all       = new ModShapes.All(shapeDatum);
            GenAction[]   clearTile = new GenAction[] { new Actions.ClearTile(false), new Actions.SetLiquid(0, 0), new Actions.SetFrames(true), new Modifiers.OnlyWalls(new byte[1]), new Actions.PlaceWall(16, true) };
            WorldUtils.Gen(origin, all, Actions.Chain(clearTile));
            Searches.Down  down    = new Searches.Down(10);
            GenCondition[] isSolid = new GenCondition[] { new Conditions.IsSolid() };
            if (!WorldUtils.Find(origin, Searches.Chain(down, isSolid), out point))
            {
                return(false);
            }
            int  y    = point.Y - 1;
            bool flag = GenBase._random.Next() % 2 == 0;

            if (GenBase._random.Next() % 10 != 0)
            {
                int num2 = GenBase._random.Next(1, 4);
                int num3 = (flag ? 4 : -(num >> 1));
                for (int i = 0; i < num2; i++)
                {
                    int num4 = GenBase._random.Next(1, 3);
                    for (int j = 0; j < num4; j++)
                    {
                        WorldGen.PlaceTile(origin.X + num3 - i, y - j, 331, false, false, -1, 0);
                    }
                }
            }
            int num5 = (num - 3) * (flag ? -1 : 1);

            if (GenBase._random.Next() % 10 != 0)
            {
                WorldGen.PlaceTile(origin.X + num5, y, 186, false, false, -1, 0);
            }
            if (GenBase._random.Next() % 10 != 0)
            {
                WorldGen.PlaceTile(origin.X, y, 215, true, false, -1, 0);
                if (GenBase._tiles[origin.X, y].active() && GenBase._tiles[origin.X, y].type == 215)
                {
                    Tile tile = GenBase._tiles[origin.X, y];
                    tile.frameY = (short)(tile.frameY + 36);
                    Tile tile1 = GenBase._tiles[origin.X - 1, y];
                    tile1.frameY = (short)(tile1.frameY + 36);
                    Tile tile2 = GenBase._tiles[origin.X + 1, y];
                    tile2.frameY = (short)(tile2.frameY + 36);
                    Tile tile3 = GenBase._tiles[origin.X, y - 1];
                    tile3.frameY = (short)(tile3.frameY + 36);
                    Tile tile4 = GenBase._tiles[origin.X - 1, y - 1];
                    tile4.frameY = (short)(tile4.frameY + 36);
                    Tile tile5 = GenBase._tiles[origin.X + 1, y - 1];
                    tile5.frameY = (short)(tile5.frameY + 36);
                }
            }
            structures.AddStructure(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 4);
            return(true);
        }
Esempio n. 4
0
        public override bool Place(Point origin, StructureMap structures)
        {
            Ref <int> @ref = new Ref <int>(0);
            Ref <int> ref2 = new Ref <int>(0);

            WorldUtils.Gen(origin, new Shapes.Circle(10), Actions.Chain(new Actions.Scanner(ref2), new Modifiers.IsSolid(), new Actions.Scanner(@ref)));
            if (@ref.Value < ref2.Value - 5)
            {
                return(false);
            }
            int num  = GenBase._random.Next(6, 10);
            int num2 = GenBase._random.Next(5);

            if (!structures.CanPlace(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2)))
            {
                return(false);
            }
            ShapeData data    = new ShapeData();
            Point     origin2 = origin;

            Shapes.Slime shape = new Shapes.Slime(num);
            GenAction[]  array = new GenAction[6]
            {
                new Modifiers.Blotches(num2, num2, num2, 1).Output(data),
                new Modifiers.Offset(0, -2),
                new Modifiers.OnlyTiles(53),
                new Actions.SetTile(397, setSelfFrames: true),
                null,
                null
            };
            byte[] types = new byte[1];
            array[4] = new Modifiers.OnlyWalls(types);
            array[5] = new Actions.PlaceWall(16);
            WorldUtils.Gen(origin2, shape, Actions.Chain(array));
            Point origin3 = origin;

            ModShapes.All shape2 = new ModShapes.All(data);
            GenAction[]   array2 = new GenAction[5]
            {
                new Actions.ClearTile(),
                new Actions.SetLiquid(0, 0),
                new Actions.SetFrames(frameNeighbors: true),
                null,
                null
            };
            byte[] types2 = new byte[1];
            array2[3] = new Modifiers.OnlyWalls(types2);
            array2[4] = new Actions.PlaceWall(16);
            WorldUtils.Gen(origin3, shape2, Actions.Chain(array2));
            if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(10), new Conditions.IsSolid()), out Point result))
            {
                return(false);
            }
            int  num3 = result.Y - 1;
            bool flag = GenBase._random.Next() % 2 == 0;

            if (GenBase._random.Next() % 10 != 0)
            {
                int num4 = GenBase._random.Next(1, 4);
                int num5 = flag ? 4 : (-(num >> 1));
                for (int i = 0; i < num4; i++)
                {
                    int num6 = GenBase._random.Next(1, 3);
                    for (int j = 0; j < num6; j++)
                    {
                        WorldGen.PlaceTile(origin.X + num5 - i, num3 - j, 331);
                    }
                }
            }
            int num7 = (num - 3) * ((!flag) ? 1 : (-1));

            if (GenBase._random.Next() % 10 != 0)
            {
                WorldGen.PlaceTile(origin.X + num7, num3, 186);
            }
            if (GenBase._random.Next() % 10 != 0)
            {
                WorldGen.PlaceTile(origin.X, num3, 215, mute: true);
                if (GenBase._tiles[origin.X, num3].active() && GenBase._tiles[origin.X, num3].type == 215)
                {
                    GenBase._tiles[origin.X, num3].frameY         += 36;
                    GenBase._tiles[origin.X - 1, num3].frameY     += 36;
                    GenBase._tiles[origin.X + 1, num3].frameY     += 36;
                    GenBase._tiles[origin.X, num3 - 1].frameY     += 36;
                    GenBase._tiles[origin.X - 1, num3 - 1].frameY += 36;
                    GenBase._tiles[origin.X + 1, num3 - 1].frameY += 36;
                }
            }
            structures.AddStructure(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 4);
            return(true);
        }
Esempio n. 5
0
        public override bool Place(Point origin, StructureMap structures)
        {
            Ref <int> @ref = new Ref <int>(0);
            Ref <int> ref2 = new Ref <int>(0);

            WorldUtils.Gen(origin, new Shapes.Circle(10), Actions.Chain(new GenAction[]
            {
                new Actions.Scanner(ref2),
                new Modifiers.IsSolid(),
                new Actions.Scanner(@ref)
            }));
            if (@ref.Value < ref2.Value - 5)
            {
                return(false);
            }
            int num  = GenBase._random.Next(6, 10);
            int num2 = GenBase._random.Next(5);

            if (!structures.CanPlace(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 0))
            {
                return(false);
            }
            ShapeData data      = new ShapeData();
            Point     arg_12A_0 = origin;
            GenShape  arg_12A_1 = new Shapes.Slime(num);

            GenAction[] array = new GenAction[6];
            array[0] = new Modifiers.Blotches(num2, num2, num2, 1, 0.3).Output(data);
            array[1] = new Modifiers.Offset(0, -2);
            array[2] = new Modifiers.OnlyTiles(new ushort[]
            {
                53
            });
            array[3] = new Actions.SetTile(397, true, true);
            GenAction[] arg_116_0 = array;
            int         arg_116_1 = 4;

            byte[] types = new byte[1];
            arg_116_0[arg_116_1] = new Modifiers.OnlyWalls(types);
            array[5]             = new Actions.PlaceWall(16, true);
            WorldUtils.Gen(arg_12A_0, arg_12A_1, Actions.Chain(array));
            Point    arg_185_0 = origin;
            GenShape arg_185_1 = new ModShapes.All(data);

            GenAction[] array2 = new GenAction[5];
            array2[0] = new Actions.ClearTile(false);
            array2[1] = new Actions.SetLiquid(0, 0);
            array2[2] = new Actions.SetFrames(true);
            GenAction[] arg_171_0 = array2;
            int         arg_171_1 = 3;

            byte[] types2 = new byte[1];
            arg_171_0[arg_171_1] = new Modifiers.OnlyWalls(types2);
            array2[4]            = new Actions.PlaceWall(16, true);
            WorldUtils.Gen(arg_185_0, arg_185_1, Actions.Chain(array2));
            Point point;

            if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(10), new GenCondition[]
            {
                new Conditions.IsSolid()
            }), out point))
            {
                return(false);
            }
            int  num3 = point.Y - 1;
            bool flag = GenBase._random.Next() % 2 == 0;

            if (GenBase._random.Next() % 10 != 0)
            {
                int num4 = GenBase._random.Next(1, 4);
                int num5 = flag ? 4 : (-(num >> 1));
                for (int i = 0; i < num4; i++)
                {
                    int num6 = GenBase._random.Next(1, 3);
                    for (int j = 0; j < num6; j++)
                    {
                        WorldGen.PlaceTile(origin.X + num5 - i, num3 - j, 331, false, false, -1, 0);
                    }
                }
            }
            int num7 = (num - 3) * (flag ? -1 : 1);

            if (GenBase._random.Next() % 10 != 0)
            {
                WorldGen.PlaceTile(origin.X + num7, num3, 186, false, false, -1, 0);
            }
            if (GenBase._random.Next() % 10 != 0)
            {
                WorldGen.PlaceTile(origin.X, num3, 215, true, false, -1, 0);
                if (GenBase._tiles[origin.X, num3].active() && GenBase._tiles[origin.X, num3].type == 215)
                {
                    Tile expr_305 = GenBase._tiles[origin.X, num3];
                    expr_305.frameY += 36;
                    Tile expr_329 = GenBase._tiles[origin.X - 1, num3];
                    expr_329.frameY += 36;
                    Tile expr_34D = GenBase._tiles[origin.X + 1, num3];
                    expr_34D.frameY += 36;
                    Tile expr_371 = GenBase._tiles[origin.X, num3 - 1];
                    expr_371.frameY += 36;
                    Tile expr_397 = GenBase._tiles[origin.X - 1, num3 - 1];
                    expr_397.frameY += 36;
                    Tile expr_3BD = GenBase._tiles[origin.X + 1, num3 - 1];
                    expr_3BD.frameY += 36;
                }
            }
            structures.AddStructure(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 4);
            return(true);
        }