Exemplo n.º 1
0
 protected override void AgeRoom(Rectangle room)
 {
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.800000011920929), new Modifiers.Blotches(2, 0.20000000298023224), new Modifiers.OnlyTiles(base.TileType), new Actions.SetTileKeepWall(396, setSelfFrames: true), new Modifiers.Dither(), new Actions.SetTileKeepWall(397, setSelfFrames: true)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(), new Modifiers.OnlyTiles(397, 396), 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 Modifiers.Dither(), new Modifiers.OnlyTiles(397, 396), new Modifiers.Offset(0, 1), new ActionStalagtite()));
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.800000011920929), new Modifiers.Blotches(), new Modifiers.OnlyWalls(base.WallType), new Actions.PlaceWall(216)));
 }
Exemplo n.º 2
0
 internal static void AgeDesertRoom(Rectangle room)
 {
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.800000011920929), new Modifiers.Blotches(2, 0.20000000298023224), new Modifiers.OnlyTiles(BuildData.Desert.Tile), new Actions.SetTile(396, setSelfFrames: true), new Modifiers.Dither(), new Actions.SetTile(397, setSelfFrames: true)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(), new Modifiers.OnlyTiles(397, 396), 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 Modifiers.Dither(), new Modifiers.OnlyTiles(397, 396), new Modifiers.Offset(0, 1), new ActionStalagtite()));
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.800000011920929), new Modifiers.Blotches(), new Modifiers.OnlyWalls(BuildData.Desert.Wall), new Actions.PlaceWall(216)));
 }
Exemplo n.º 3
0
 internal static void AgeGraniteRoom(Rectangle room)
 {
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.60000002384185791), new Modifiers.Blotches(2, 0.60000002384185791), new Modifiers.OnlyTiles(BuildData.Granite.Tile), new Actions.SetTile(368, setSelfFrames: true)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(0.800000011920929), new Modifiers.OnlyTiles(368), 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 Modifiers.Dither(0.800000011920929), new Modifiers.OnlyTiles(368), new Modifiers.Offset(0, 1), new ActionStalagtite()));
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.85000002384185791), new Modifiers.Blotches(), new Actions.PlaceWall(180)));
 }
 protected override void AgeRoom(Rectangle room)
 {
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.699999988079071), new Modifiers.Blotches(2, 0.5), new Modifiers.OnlyTiles(base.TileType), new Actions.SetTileKeepWall(70, setSelfFrames: true)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(0.60000002384185791), new Modifiers.OnlyTiles(70), new Modifiers.Offset(0, -1), new Modifiers.IsEmpty(), new Actions.SetTile(71)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y + room.Height - 1), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(0.60000002384185791), new Modifiers.OnlyTiles(70), new Modifiers.Offset(0, -1), new Modifiers.IsEmpty(), new Actions.SetTile(71)));
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.85000002384185791), new Modifiers.Blotches(), new Actions.ClearWall()));
 }
Exemplo n.º 5
0
        public override bool Place(Point origin, StructureMap structures)
        {
            var resultsOutput = new Dictionary <ushort, int>();

            WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), new Shapes.Rectangle(50, 50),
                           new Actions.TileScanner((ushort)0, (ushort)59, (ushort)147, (ushort)1).Output(resultsOutput));
            var num1 = resultsOutput[0] + resultsOutput[1];
            var num2 = resultsOutput[59];
            var num3 = resultsOutput[147];

            if (num3 <= num2 || num3 <= num1)
            {
                return(false);
            }
            var num4 = 0;

            for (var radius = _random.Next(10, 15); radius > 5; --radius)
            {
                var num5 = _random.Next(-5, 5);
                WorldUtils.Gen(new Point(origin.X + num5, origin.Y + num4), new Shapes.Circle(radius),
                               Actions.Chain((GenAction) new Modifiers.Blotches(4, 0.3),
                                             (GenAction) new Modifiers.OnlyTiles((ushort)147, (ushort)161, (ushort)224, (ushort)0,
                                                                                 (ushort)1), (GenAction) new Actions.SetTile(162, true, true)));
                WorldUtils.Gen(new Point(origin.X + num5, origin.Y + num4), new Shapes.Circle(radius),
                               Actions.Chain((GenAction) new Modifiers.Blotches(4, 0.3),
                                             (GenAction) new Modifiers.HasLiquid(-1, -1),
                                             (GenAction) new Actions.SetTile(162, true, true),
                                             (GenAction) new Actions.SetLiquid(0, 0)));
                num4 += radius - 2;
            }

            return(true);
        }
Exemplo n.º 6
0
 protected override void AgeRoom(Rectangle room)
 {
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.60000002384185791), new Modifiers.Blotches(2, 0.60000002384185791), new Modifiers.OnlyTiles(base.TileType), new Actions.SetTileKeepWall(60, setSelfFrames: true), new Modifiers.Dither(0.800000011920929), new Actions.SetTileKeepWall(59, setSelfFrames: true)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(), new Modifiers.OnlyTiles(60), new Modifiers.Offset(0, 1), new Modifiers.IsEmpty(), new ActionVines(3, room.Height, 62)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y + room.Height - 1), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(), new Modifiers.OnlyTiles(60), new Modifiers.Offset(0, 1), new Modifiers.IsEmpty(), new ActionVines(3, room.Height, 62)));
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.85000002384185791), new Modifiers.Blotches(), new Actions.PlaceWall(64)));
 }
Exemplo n.º 7
0
        public override bool Place(Point origin, StructureMap structures)
        {
            Dictionary <ushort, int> resultsOutput = new Dictionary <ushort, int>();

            WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), (GenShape) new Shapes.Rectangle(50, 50), (GenAction) new Actions.TileScanner(new ushort[2]
            {
                (ushort)0,
                (ushort)1
            }).Output(resultsOutput));
            if (resultsOutput[(ushort)0] + resultsOutput[(ushort)1] < 1250)
            {
                return(false);
            }
            Point result1;
            bool  flag = WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 50).Not()), out result1);
            Point result2;

            if (WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Up((int)(origin.Y - result1.Y)), (GenCondition) new Conditions.IsTile(new ushort[1]
            {
                (ushort)53
            })), out result2) || !flag)
            {
                return(false);
            }
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            __Null& local = @result1.Y;
            // ISSUE: cast to a reference type
            // ISSUE: explicit reference operation
            int num = ^ (int&)local + 50;
        private static void PlaceAt(DesertDescription description, Point position, int holeRadius)
        {
            ShapeData data   = new ShapeData();
            Point     origin = new Point(position.X, position.Y + 6);

            WorldUtils.Gen(origin, new Shapes.Tail(holeRadius * 2, new Vector2(0f, (float)(-holeRadius) * 1.5f)), Actions.Chain(new Actions.SetTile(53).Output(data)));
            GenShapeActionPair genShapeActionPair  = new GenShapeActionPair(new Shapes.Rectangle(1, 1), Actions.Chain(new Modifiers.Blotches(), new Modifiers.IsSolid(), new Actions.Clear(), new Actions.PlaceWall(187)));
            GenShapeActionPair genShapeActionPair2 = new GenShapeActionPair(new Shapes.Rectangle(1, 1), Actions.Chain(new Modifiers.IsSolid(), new Actions.Clear(), new Actions.PlaceWall(187)));
            GenShapeActionPair pair  = new GenShapeActionPair(new Shapes.Circle(2, 3), Actions.Chain(new Modifiers.IsSolid(), new Actions.SetTile(397), new Actions.PlaceWall(187)));
            GenShapeActionPair pair2 = new GenShapeActionPair(new Shapes.Circle(holeRadius, 3), Actions.Chain(new Modifiers.SkipWalls(187), new Actions.SetTile(53)));
            GenShapeActionPair pair3 = new GenShapeActionPair(new Shapes.Circle(holeRadius - 2, 3), Actions.Chain(new Actions.PlaceWall(187)));
            int num = position.X;

            for (int i = position.Y - holeRadius - 3; i < description.Hive.Top + (position.Y - description.Desert.Top) * 2 + 12; i++)
            {
                WorldUtils.Gen(new Point(num, i), (i < position.Y) ? genShapeActionPair2 : genShapeActionPair);
                WorldUtils.Gen(new Point(num, i), pair);
                if (i % 3 == 0 && i >= position.Y)
                {
                    num += WorldGen.genRand.Next(-1, 2);
                    WorldUtils.Gen(new Point(num, i), genShapeActionPair);
                    if (i >= position.Y + 5)
                    {
                        WorldUtils.Gen(new Point(num, i), pair2);
                        WorldUtils.Gen(new Point(num, i), pair3);
                    }
                    WorldUtils.Gen(new Point(num, i), pair);
                }
            }
            WorldUtils.Gen(new Point(origin.X, origin.Y - (int)((float)holeRadius * 1.5f) + 3), new Shapes.Circle(holeRadius / 2, holeRadius / 3), Actions.Chain(Actions.Chain(new Actions.ClearTile(), new Modifiers.Expand(1), new Actions.PlaceWall(0))));
            WorldUtils.Gen(origin, new ModShapes.All(data), new Actions.Smooth());
        }
Exemplo n.º 9
0
 private void PlacePlatforms()
 {
     foreach (Point platforms in this.CreatePlatformsList())
     {
         WorldUtils.Gen(platforms, (GenShape) new Shapes.Rectangle(3, 1), Actions.Chain((GenAction) new Actions.ClearMetadata(), (GenAction) new Actions.PlaceTile((ushort)19, this.PlatformStyle), (GenAction) new Actions.SetFrames(true)));
     }
 }
Exemplo n.º 10
0
        public override bool Place(Point origin, StructureMap structures)
        {
            if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y, false))
            {
                return(false);
            }
            Point result;

            if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(80), (GenCondition) new Conditions.IsSolid()), out result))
            {
                return(false);
            }
            result.Y += 2;
            Ref <int> count = new Ref <int>(0);

            WorldUtils.Gen(result, (GenShape) new Shapes.Circle(8), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count)));
            if (count.Value < 20 || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(result.X - 8, result.Y - 8, 16, 16), 0))
            {
                return(false);
            }
            WorldUtils.Gen(result, (GenShape) new Shapes.Circle(8), Actions.Chain((GenAction) new Modifiers.RadialDither(0.0f, 10f), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.SetTile((ushort)229, true, true)));
            ShapeData data = new ShapeData();

            WorldUtils.Gen(result, (GenShape) new Shapes.Circle(4, 3), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.3), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.ClearTile(true), new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data), (GenAction) new Actions.SetLiquid(2, byte.MaxValue)));
            WorldUtils.Gen(new Point(result.X, result.Y + 1), (GenShape) new ModShapes.InnerOutline(data, true), Actions.Chain((GenAction) new Modifiers.IsEmpty(), (GenAction) new Modifiers.RectangleMask(-6, 6, 1, 3), (GenAction) new Actions.SetTile((ushort)59, true, true)));
            structures.AddProtectedStructure(new Microsoft.Xna.Framework.Rectangle(result.X - 8, result.Y - 8, 16, 16), 0);
            return(true);
        }
Exemplo n.º 11
0
        public override bool Place(Point origin, StructureMap structures)
        {
            Dictionary <ushort, int> resultsOutput = new Dictionary <ushort, int>();

            WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(new ushort[4] {
                0, 59, 147, 1
            }).Output(resultsOutput));
            int num1 = resultsOutput[0] + resultsOutput[1];
            int num2 = resultsOutput[59];
            int num3 = resultsOutput[147];

            if (num3 <= num2 || num3 <= num1)
            {
                return(false);
            }

            int num4 = 0;

            for (int radius = GenBase._random.Next(10, 15); radius > 5; --radius)
            {
                int num5 = GenBase._random.Next(-5, 5);
                WorldUtils.Gen(new Point(origin.X + num5, origin.Y + num4), new Shapes.Circle(radius), Actions.Chain(new Modifiers.Blotches(4, 0.3),
                                                                                                                     new Modifiers.OnlyTiles(new ushort[5] {
                    147, 161, 224, 0, 1
                }), new Actions.SetTile(162, true, true)));
                WorldUtils.Gen(new Point(origin.X + num5, origin.Y + num4), new Shapes.Circle(radius), Actions.Chain(new Modifiers.Blotches(4, 0.3),
                                                                                                                     new Modifiers.HasLiquid(-1, -1), new Actions.SetTile(162, true, true), new Actions.SetLiquid(0, 0)));
                num4 += radius - 2;
            }

            return(true);
        }
Exemplo n.º 12
0
        public override bool Place(Point origin, StructureMap structures)
        {
            Rectangle structureBound = new Rectangle(origin.X - WIDTH / 2, origin.Y - HEIGHT / 2, WIDTH, HEIGHT);

            if (!structures.CanPlace(structureBound))
            {
                return(false);
            }


            Dictionary <ushort, int> environmentTile = new Dictionary <ushort, int>();

            WorldUtils.Gen(structureBound.Location, new Shapes.Rectangle(WIDTH, HEIGHT), new Actions.TileScanner(
                               new ushort[]
            {
                (ushort)ModLoader.GetMod("TUA").TileType("StardustRock"),
                (ushort)ModLoader.GetMod("TUA").TileType("StardustIce")
            }
                               ).Output(environmentTile));

            int total = 0;

            foreach (KeyValuePair <ushort, int> pair in environmentTile)
            {
                total += pair.Value;
            }

            if (total < 4000)
            {
                return(false);
            }

            generateForest(origin);
            return(true);
        }
Exemplo n.º 13
0
        public void generateRuin(Point origin, int width, int height, int integretyPercent, bool chest = false)
        {
            ShapeData data = new ShapeData();

            origin.X -= width / 2;
            origin.Y -= height / 2;

            WorldUtils.Gen(origin, new Shapes.Rectangle(width + 2, height + 2), Actions.Chain(new GenAction[]
            {
                new Actions.ClearTile(true),
                new Actions.PlaceTile(TileID.CobaltBrick)
            }));

            origin.X++;
            origin.Y++;

            WorldUtils.Gen(origin, new Shapes.Rectangle(width, height), Actions.Chain(new GenAction[]
            {
                new Actions.ClearTile(true),
                new Modifiers.Conditions(new IntegretyFilter(integretyPercent)),
                new Actions.PlaceWall(WallID.IceBrick)
            }));

            int x = origin.X - 1 + WorldGen.genRand.Next(width - 2);
            int y = origin.Y + height - 1;

            WorldGen.PlaceTile(x, y, ModContent.TileType <MobSpawner>());
            ModContent.GetInstance <MobSpawnerEntity>().Place(x - 1, y - 1);
        }
Exemplo n.º 14
0
 private void PlacePlatforms()
 {
     foreach (Point item in CreatePlatformsList())
     {
         WorldUtils.Gen(item, new Shapes.Rectangle(3, 1), Actions.Chain(new Actions.ClearMetadata(), new Actions.PlaceTile(19, PlatformStyle), new Actions.SetFrames(frameNeighbors: true)));
     }
 }
Exemplo n.º 15
0
 internal static void AgeJungleRoom(Rectangle room)
 {
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.60000002384185791), new Modifiers.Blotches(2, 0.60000002384185791), new Modifiers.OnlyTiles(BuildData.Jungle.Tile), new Actions.SetTile(60, setSelfFrames: true), new Modifiers.Dither(0.800000011920929), new Actions.SetTile(59, setSelfFrames: true)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(), new Modifiers.OnlyTiles(60), new Modifiers.Offset(0, 1), new ActionVines(3, room.Height, 62)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y + room.Height - 1), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(), new Modifiers.OnlyTiles(60), new Modifiers.Offset(0, 1), new ActionVines(3, room.Height, 62)));
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.85000002384185791), new Modifiers.Blotches(), new Actions.PlaceWall(64)));
 }
Exemplo n.º 16
0
        public override bool Place(Point origin, StructureMap structures)
        {
            Dictionary <ushort, int> dictionary = new Dictionary <ushort, int>();

            WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(0, 59, 147, 1, 225).Output(dictionary));
            int num  = dictionary[0] + dictionary[1];
            int num2 = dictionary[59];
            int num3 = dictionary[147];

            if (dictionary[225] > 0)
            {
                return(false);
            }
            if (num3 <= num2 || num3 <= num)
            {
                return(false);
            }
            int num4 = 0;

            for (int num5 = GenBase._random.Next(10, 15); num5 > 5; num5--)
            {
                int num6 = GenBase._random.Next(-5, 5);
                WorldUtils.Gen(new Point(origin.X + num6, origin.Y + num4), new Shapes.Circle(num5), Actions.Chain(new Modifiers.Blotches(4), new Modifiers.OnlyTiles(147, 161, 224, 0, 1), new Actions.SetTile(162, setSelfFrames: true)));
                WorldUtils.Gen(new Point(origin.X + num6, origin.Y + num4), new Shapes.Circle(num5), Actions.Chain(new Modifiers.Blotches(4), new Modifiers.HasLiquid(), new Actions.SetTile(162, setSelfFrames: true), new Actions.SetLiquid(0, 0)));
                num4 += num5 - 2;
            }
            structures.AddStructure(new Rectangle(origin.X - 25, origin.Y - 25, 50, 50), 8);
            return(true);
        }
Exemplo n.º 17
0
        private static HouseType GetHouseType(IEnumerable <Microsoft.Xna.Framework.Rectangle> rooms)
        {
            Dictionary <ushort, int> resultsOutput = new Dictionary <ushort, int>();

            foreach (Microsoft.Xna.Framework.Rectangle room in rooms)
            {
                WorldUtils.Gen(new Point(room.X - 10, room.Y - 10), (GenShape) new Shapes.Rectangle(room.Width + 20, room.Height + 20), (GenAction) new Actions.TileScanner(new ushort[12]
                {
                    (ushort)0,
                    (ushort)59,
                    (ushort)147,
                    (ushort)1,
                    (ushort)161,
                    (ushort)53,
                    (ushort)396,
                    (ushort)397,
                    (ushort)368,
                    (ushort)367,
                    (ushort)60,
                    (ushort)70
                }).Output(resultsOutput));
            }
            List <Tuple <HouseType, int> > tupleList = new List <Tuple <HouseType, int> >();

            tupleList.Add(Tuple.Create <HouseType, int>(HouseType.Wood, resultsOutput[(ushort)0] + resultsOutput[(ushort)1]));
            tupleList.Add(Tuple.Create <HouseType, int>(HouseType.Jungle, resultsOutput[(ushort)59] + resultsOutput[(ushort)60] * 10));
            tupleList.Add(Tuple.Create <HouseType, int>(HouseType.Mushroom, resultsOutput[(ushort)59] + resultsOutput[(ushort)70] * 10));
            tupleList.Add(Tuple.Create <HouseType, int>(HouseType.Ice, resultsOutput[(ushort)147] + resultsOutput[(ushort)161]));
            tupleList.Add(Tuple.Create <HouseType, int>(HouseType.Desert, resultsOutput[(ushort)397] + resultsOutput[(ushort)396] + resultsOutput[(ushort)53]));
            tupleList.Add(Tuple.Create <HouseType, int>(HouseType.Granite, resultsOutput[(ushort)368]));
            tupleList.Add(Tuple.Create <HouseType, int>(HouseType.Marble, resultsOutput[(ushort)367]));
            tupleList.Sort(new Comparison <Tuple <HouseType, int> >(HouseUtils.SortBiomeResults));
            return(tupleList[0].Item1);
        }
Exemplo n.º 18
0
        public override bool Place(Point origin, StructureMap structures)
        {
            if (GenBase._tiles[(int)origin.X, (int)origin.Y].active() && WorldGen.SolidTile((int)origin.X, (int)origin.Y))
            {
                return(false);
            }
            Point result;

            if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(80), (GenCondition) new Conditions.IsSolid()), out result))
            {
                return(false);
            }
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            Point& local = @result;
            // ISSUE: explicit reference operation
            int num = (^ local).Y + 2;

            // ISSUE: explicit reference operation
            (^ local).Y = (__Null)num;
            Ref <int> count = new Ref <int>(0);

            WorldUtils.Gen(result, (GenShape) new Shapes.Circle(8), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count)));
            if (count.Value < 20 || !structures.CanPlace(new Rectangle(result.X - 8, result.Y - 8, 16, 16), 0))
            {
                return(false);
            }
            WorldUtils.Gen(result, (GenShape) new Shapes.Circle(8), Actions.Chain((GenAction) new Modifiers.RadialDither(0.0f, 10f), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.SetTile((ushort)229, true, true)));
            ShapeData data = new ShapeData();

            WorldUtils.Gen(result, (GenShape) new Shapes.Circle(4, 3), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.3), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.ClearTile(true), new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data), (GenAction) new Actions.SetLiquid(2, byte.MaxValue)));
            WorldUtils.Gen(new Point((int)result.X, result.Y + 1), (GenShape) new ModShapes.InnerOutline(data, true), Actions.Chain((GenAction) new Modifiers.IsEmpty(), (GenAction) new Modifiers.RectangleMask(-6, 6, 1, 3), (GenAction) new Actions.SetTile((ushort)59, true, true)));
            structures.AddStructure(new Rectangle(result.X - 8, result.Y - 8, 16, 16), 0);
            return(true);
        }
Exemplo n.º 19
0
 protected override void AgeRoom(Rectangle room)
 {
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.60000002384185791), new Modifiers.Blotches(2, 0.60000002384185791), new Modifiers.OnlyTiles(base.TileType), new Actions.SetTileKeepWall(161, setSelfFrames: true), new Modifiers.Dither(0.8), new Actions.SetTileKeepWall(147, setSelfFrames: true)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(), new Modifiers.OnlyTiles(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 Modifiers.Dither(), new Modifiers.OnlyTiles(161), new Modifiers.Offset(0, 1), new ActionStalagtite()));
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.85000002384185791), new Modifiers.Blotches(2, 0.8), new Modifiers.SkipTiles(SkipTilesDuringWallAging), ((double)room.Y > Main.worldSurface) ? ((GenAction) new Actions.ClearWall(frameNeighbors: true)) : ((GenAction) new Actions.PlaceWall(40))));
 }
Exemplo n.º 20
0
        public override bool Place(Point origin, StructureMap structures)
        {
            //this handles generating the actual tiles, but you still need to add things like treegen etc. I know next to nothing about treegen so you're on your own there, lol.

            Mod mod         = SauceMod.instance;
            int biomeRadius = 300;

            Dictionary <Color, int> colorToTile = new Dictionary <Color, int>();

            colorToTile[new Color(0, 255, 0)] = -2;
            colorToTile[Color.Black]          = -1; //don't touch when genning


            Texture2D Infection = mod.GetTexture("WorldGen/SauceWorld_Tiles");

            TexGen gen       = BaseWorldGenTex.GetTexGenerator(Infection, colorToTile);
            Point  newOrigin = new Point(origin.X, origin.Y);                                       //biomeRadius);

            WorldUtils.Gen(newOrigin, new Shapes.Circle(biomeRadius), Actions.Chain(new GenAction[] //remove all fluids in sphere...
            {
                new Modifiers.RadialDither(biomeRadius - 5, biomeRadius),
                new Actions.SetLiquid(0, 0)
            }));
            WorldUtils.Gen(new Point(origin.X - (gen.width / 2), origin.Y - 20), new Shapes.Rectangle(gen.width, gen.height), Actions.Chain(new GenAction[] //remove all fluids in the volcano...
            {
                new Actions.SetLiquid(0, 0)
            }));
            gen.Generate(origin.X - (gen.width / 2), origin.Y, true, true);

            return(true);
        }
Exemplo n.º 21
0
        public override bool Place(Point origin, StructureMap structures)
        {
            Dictionary <ushort, int> dictionary = new Dictionary <ushort, int>();

            WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(0, 1).Output(dictionary));
            int num = dictionary[0] + dictionary[1];

            if (num < 1250)
            {
                return(false);
            }
            Point result;
            bool  flag = WorldUtils.Find(origin, Searches.Chain(new Searches.Up(1000), new Conditions.IsSolid().AreaOr(1, 50).Not()), out result);
            Point result2;

            if (WorldUtils.Find(origin, Searches.Chain(new Searches.Up(origin.Y - result.Y), new Conditions.IsTile(53)), out result2))
            {
                return(false);
            }
            if (!flag)
            {
                return(false);
            }
            result.Y += 50;
            ShapeData shapeData  = new ShapeData();
            ShapeData shapeData2 = new ShapeData();
            Point     point      = new Point(origin.X, origin.Y + 20);
            Point     point2     = new Point(origin.X, origin.Y + 30);
            float     num2       = 0.8f + GenBase._random.NextFloat() * 0.5f;

            if (!structures.CanPlace(new Rectangle(point.X - (int)(20f * num2), point.Y - 20, (int)(40f * num2), 40)))
            {
                return(false);
            }
            if (!structures.CanPlace(new Rectangle(origin.X, result.Y + 10, 1, origin.Y - result.Y - 9), 2))
            {
                return(false);
            }
            WorldUtils.Gen(point, new Shapes.Slime(20, num2, 1f), Actions.Chain(new Modifiers.Blotches(2, 0.4), new Actions.ClearTile(true).Output(shapeData)));
            WorldUtils.Gen(point2, new Shapes.Mound(14, 14), Actions.Chain(new Modifiers.Blotches(2, 1, 0.8), new Actions.SetTile(0), new Actions.SetFrames(true).Output(shapeData2)));
            shapeData.Subtract(shapeData2, point, point2);
            WorldUtils.Gen(point, new ModShapes.InnerOutline(shapeData), Actions.Chain(new Actions.SetTile(2), new Actions.SetFrames(true)));
            WorldUtils.Gen(point, new ModShapes.All(shapeData), Actions.Chain(new Modifiers.RectangleMask(-40, 40, 0, 40), new Modifiers.IsEmpty(), new Actions.SetLiquid()));
            WorldUtils.Gen(point, new ModShapes.All(shapeData), Actions.Chain(new Actions.PlaceWall(68), new Modifiers.OnlyTiles(2), new Modifiers.Offset(0, 1), new ActionVines(3, 5)));
            ShapeData data = new ShapeData();

            WorldUtils.Gen(new Point(origin.X, result.Y + 10), new Shapes.Rectangle(1, origin.Y - result.Y - 9), Actions.Chain(new Modifiers.Blotches(2, 0.2), new Actions.ClearTile().Output(data), new Modifiers.Expand(1), new Modifiers.OnlyTiles(53), new Actions.SetTile(397).Output(data)));
            WorldUtils.Gen(new Point(origin.X, result.Y + 10), new ModShapes.All(data), new Actions.SetFrames(true));
            if (GenBase._random.Next(3) == 0)
            {
                WorldGen.PlaceTile(point2.X, point2.Y - 15, 187, true, false, -1, 17);
            }
            else
            {
                WorldGen.PlaceTile(point2.X, point2.Y - 15, 186, true, false, -1, 15);
            }
            WorldUtils.Gen(point2, new ModShapes.All(shapeData2), Actions.Chain(new Modifiers.Offset(0, -1), new Modifiers.OnlyTiles(2), new Modifiers.Offset(0, -1), new ActionGrass()));
            structures.AddStructure(new Rectangle(point.X - (int)(20f * num2), point.Y - 20, (int)(40f * num2), 40), 4);
            return(true);
        }
Exemplo n.º 22
0
 internal static void AgeSnowRoom(Rectangle room)
 {
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.60000002384185791), new Modifiers.Blotches(2, 0.60000002384185791), new Modifiers.OnlyTiles(BuildData.Snow.Tile), new Actions.SetTile(161, setSelfFrames: true), new Modifiers.Dither(0.8), new Actions.SetTile(147, setSelfFrames: true)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(), new Modifiers.OnlyTiles(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 Modifiers.Dither(), new Modifiers.OnlyTiles(161), new Modifiers.Offset(0, 1), new ActionStalagtite()));
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.85000002384185791), new Modifiers.Blotches(2, 0.8), ((double)room.Y > Main.worldSurface) ? ((GenAction) new Actions.ClearWall(frameNeighbors: true)) : ((GenAction) new Actions.PlaceWall(40))));
 }
Exemplo n.º 23
0
        public override bool Place(Point origin, StructureMap structures)
        {
            if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y))
            {
                return(false);
            }
            if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(80), new Conditions.IsSolid()), out var result))
            {
                return(false);
            }
            result.Y += 2;
            Ref <int> @ref = new Ref <int>(0);

            WorldUtils.Gen(result, new Shapes.Circle(8), Actions.Chain(new Modifiers.IsSolid(), new Actions.Scanner(@ref)));
            if (@ref.Value < 20)
            {
                return(false);
            }
            if (!structures.CanPlace(new Rectangle(result.X - 8, result.Y - 8, 16, 16)))
            {
                return(false);
            }
            WorldUtils.Gen(result, new Shapes.Circle(8), Actions.Chain(new Modifiers.RadialDither(0f, 10f), new Modifiers.IsSolid(), new Actions.SetTile(229, setSelfFrames: true)));
            ShapeData data = new ShapeData();

            WorldUtils.Gen(result, new Shapes.Circle(4, 3), Actions.Chain(new Modifiers.Blotches(), new Modifiers.IsSolid(), new Actions.ClearTile(frameNeighbors: true), new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data), new Actions.SetLiquid(2)));
            WorldUtils.Gen(new Point(result.X, result.Y + 1), new ModShapes.InnerOutline(data), Actions.Chain(new Modifiers.IsEmpty(), new Modifiers.RectangleMask(-6, 6, 1, 3), new Actions.SetTile(59, setSelfFrames: true)));
            structures.AddProtectedStructure(new Rectangle(result.X - 8, result.Y - 8, 16, 16));
            return(true);
        }
Exemplo n.º 24
0
 internal static void AgeMushroomRoom(Rectangle room)
 {
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.699999988079071), new Modifiers.Blotches(2, 0.5), new Modifiers.OnlyTiles(BuildData.Mushroom.Tile), new Actions.SetTile(70, setSelfFrames: true)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(0.60000002384185791), new Modifiers.OnlyTiles(70), new Modifiers.Offset(0, -1), new Actions.SetTile(71)));
     WorldUtils.Gen(new Point(room.X + 1, room.Y + room.Height - 1), new Shapes.Rectangle(room.Width - 2, 1), Actions.Chain(new Modifiers.Dither(0.60000002384185791), new Modifiers.OnlyTiles(70), new Modifiers.Offset(0, -1), new Actions.SetTile(71)));
     WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.Dither(0.85000002384185791), new Modifiers.Blotches(), new Actions.ClearWall()));
 }
Exemplo n.º 25
0
        public override bool Place(Point origin, StructureMap structures)
        {
            if (WorldGen.SolidTile(origin.X, origin.Y) && GenBase._tiles[origin.X, origin.Y].wall == 3)
            {
                return(false);
            }

            if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(100), new Conditions.IsSolid()), out origin))
            {
                return(false);
            }

            Point result;

            if (!WorldUtils.Find(new Point(origin.X - 4, origin.Y), Searches.Chain(new Searches.Down(5), new Conditions.IsTile(new ushort[1] {
                25
            }).AreaAnd(8, 1)), out result))
            {
                return(false);
            }

            ShapeData data1      = new ShapeData();
            ShapeData shapeData1 = new ShapeData();
            ShapeData shapeData2 = new ShapeData();

            for (int index = 0; index < 6; ++index)
            {
                WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(10, 12) + index), Actions.Chain(new Modifiers.Offset(0, 5 * index + 5), new Modifiers.Blotches(3, 0.3).Output(data1)));
            }
            for (int index = 0; index < 6; ++index)
            {
                WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(5, 7) + index), Actions.Chain(new Modifiers.Offset(0, 2 * index + 18), new Modifiers.Blotches(3, 0.3).Output(shapeData1)));
            }
            for (int index = 0; index < 6; ++index)
            {
                WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(4, 6) + index / 2), Actions.Chain(new Modifiers.Offset(0, (int)(7.5 * (double)index) - 10), new Modifiers.Blotches(3, 0.3).Output(shapeData2)));
            }

            ShapeData data2 = new ShapeData(shapeData1);

            shapeData1.Subtract(shapeData2, origin, origin);
            data2.Subtract(shapeData1, origin, origin);
            Microsoft.Xna.Framework.Rectangle bounds = ShapeData.GetBounds(origin, data1, shapeData2);
            if (!structures.CanPlace(bounds, CorruptionPitBiome.ValidTiles, 2))
            {
                return(false);
            }

            WorldUtils.Gen(origin, new ModShapes.All(data1), Actions.Chain(new Actions.SetTile((ushort)25, true, true), new Actions.PlaceWall(3, true)));
            WorldUtils.Gen(origin, new ModShapes.All(shapeData1), new Actions.SetTile(0, true, true));
            WorldUtils.Gen(origin, new ModShapes.All(shapeData2), new Actions.ClearTile(true));
            WorldUtils.Gen(origin, new ModShapes.All(shapeData1), Actions.Chain(new Modifiers.IsTouchingAir(true), new Modifiers.NotTouching(0 != 0, new ushort[1] {
                25
            }), new Actions.SetTile(23, true, true)));
            WorldUtils.Gen(origin, new ModShapes.All(data2), new Actions.PlaceWall(69, true));

            structures.AddStructure(bounds, 2);
            return(true);
        }
Exemplo n.º 26
0
        private float RoomSolidPrecentage(Microsoft.Xna.Framework.Rectangle room)
        {
            float     num   = (float)(room.Width * room.Height);
            Ref <int> count = new Ref <int>(0);

            WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Count(count)));
            return((float)count.Value / num);
        }
Exemplo n.º 27
0
 private void PlaceEmptyRooms()
 {
     foreach (Microsoft.Xna.Framework.Rectangle room in this.Rooms)
     {
         WorldUtils.Gen(new Point(room.X, room.Y), (GenShape) new Shapes.Rectangle(room.Width, room.Height), Actions.Chain((GenAction) new Actions.SetTileKeepWall(this.TileType, false, true), (GenAction) new Actions.SetFrames(true)));
         WorldUtils.Gen(new Point(room.X + 1, room.Y + 1), (GenShape) new Shapes.Rectangle(room.Width - 2, room.Height - 2), Actions.Chain((GenAction) new Actions.ClearTile(true), (GenAction) new Actions.PlaceWall(this.WallType, true)));
     }
 }
Exemplo n.º 28
0
 private void PlaceDoors()
 {
     foreach (Point item in CreateDoorList())
     {
         WorldUtils.Gen(item, new Shapes.Rectangle(1, 3), new Actions.ClearTile(frameNeighbors: true));
         WorldGen.PlaceTile(item.X, item.Y, 10, mute: true, forced: true, -1, DoorStyle);
     }
 }
Exemplo n.º 29
0
 private void PlaceDoors()
 {
     foreach (Point door in this.CreateDoorList())
     {
         WorldUtils.Gen(door, (GenShape) new Shapes.Rectangle(1, 3), (GenAction) new Actions.ClearTile(true));
         WorldGen.PlaceTile(door.X, door.Y, 10, true, true, -1, this.DoorStyle);
     }
 }
Exemplo n.º 30
0
        private static float GetRoomSolidPrecentage(Rectangle room)
        {
            float     num  = room.Width * room.Height;
            Ref <int> @ref = new Ref <int>(0);

            WorldUtils.Gen(new Point(room.X, room.Y), new Shapes.Rectangle(room.Width, room.Height), Actions.Chain(new Modifiers.IsSolid(), new Actions.Count(@ref)));
            return((float)@ref.Value / num);
        }