public CanPlace ( Microsoft area, bool validTiles, int padding ) : bool | ||
area | Microsoft | |
validTiles | bool | |
padding | int | |
return | bool |
public override bool Place(Point origin, StructureMap structures) { if (!structures.CanPlace( new Microsoft.Xna.Framework.Rectangle(origin.X, origin.Y, this._width, this._height), 0)) { return(false); } for (var index1 = 0; index1 < this._width; ++index1) { for (var index2 = 0; index2 < this._height; ++index2) { var num1 = this._xMirror ? -index1 : index1; var num2 = this._yMirror ? -index2 : index2; if (this._data[index1, index2] != -1 && !this._actions[this._data[index1, index2]] .Apply(origin, num1 + origin.X, num2 + origin.Y)) { return(false); } } } structures.AddStructure( new Microsoft.Xna.Framework.Rectangle(origin.X, origin.Y, this._width, this._height), 0); return(true); }
public override bool Place(Point origin, StructureMap structures) { if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y)) return false; Point result; if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(80), new Conditions.IsSolid()), out result)) return false; result.Y += 2; Ref<int> count = new Ref<int>(0); WorldUtils.Gen(result, new Shapes.Circle(8), Actions.Chain(new Modifiers.IsSolid(), 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, new Shapes.Circle(8), Actions.Chain(new Modifiers.RadialDither(0.0f, 10f), new Modifiers.IsSolid(), new Actions.SetTile(229, true, true))); ShapeData data = new ShapeData(); WorldUtils.Gen(result, new Shapes.Circle(4, 3), Actions.Chain(new Modifiers.Blotches(2, 0.3), new Modifiers.IsSolid(), new Actions.ClearTile(true), new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data), new Actions.SetLiquid(2, byte.MaxValue))); WorldUtils.Gen(new Point(result.X, result.Y + 1), new ModShapes.InnerOutline(data, true), Actions.Chain(new Modifiers.IsEmpty(), new Modifiers.RectangleMask(-6, 6, 1, 3), new Actions.SetTile(59, true, true))); structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(result.X - 8, result.Y - 8, 16, 16), 0); return true; }
public override bool Place(Point origin, StructureMap structures) { Ref<int> count1 = new Ref<int>(0); Ref<int> count2 = new Ref<int>(0); WorldUtils.Gen(origin, new Shapes.Circle(10), Actions.Chain(new Actions.Scanner(count2), new Modifiers.IsSolid(), new Actions.Scanner(count1))); if (count1.Value < count2.Value - 5) return false; int radius = GenBase._random.Next(6, 10); int num1 = GenBase._random.Next(5); if (!structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 0)) return false; ShapeData data = new ShapeData(); WorldUtils.Gen(origin, new Shapes.Slime(radius), Actions.Chain(new Modifiers.Blotches(num1, num1, num1, 1, 0.3).Output(data), new Modifiers.Offset(0, -2), new Modifiers.OnlyTiles(new ushort[1] { 53 }), new Actions.SetTile(397, true, true), new Modifiers.OnlyWalls(new byte[1]), new Actions.PlaceWall(16, true))); WorldUtils.Gen(origin, new ModShapes.All(data), Actions.Chain(new Actions.ClearTile(false), new Actions.SetLiquid(0, 0), new Actions.SetFrames(true), new Modifiers.OnlyWalls(new byte[1]), new Actions.PlaceWall(16, true))); Point result; if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(10), new Conditions.IsSolid()), out result)) return false; int j = result.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 : -(radius >> 1); for (int index1 = 0; index1 < num2; ++index1) { int num4 = GenBase._random.Next(1, 3); for (int index2 = 0; index2 < num4; ++index2) WorldGen.PlaceTile(origin.X + num3 - index1, j - index2, 331, false, false, -1, 0); } } int num5 = (radius - 3) * (flag ? -1 : 1); if (GenBase._random.Next() % 10 != 0) WorldGen.PlaceTile(origin.X + num5, j, 186, false, false, -1, 0); if (GenBase._random.Next() % 10 != 0) { WorldGen.PlaceTile(origin.X, j, 215, true, false, -1, 0); if (GenBase._tiles[origin.X, j].active() && GenBase._tiles[origin.X, j].type == 215) { GenBase._tiles[origin.X, j].frameY += 36; GenBase._tiles[origin.X - 1, j].frameY += 36; GenBase._tiles[origin.X + 1, j].frameY += 36; GenBase._tiles[origin.X, j - 1].frameY += 36; GenBase._tiles[origin.X - 1, j - 1].frameY += 36; GenBase._tiles[origin.X + 1, j - 1].frameY += 36; } } structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 4); return true; }
public override bool Place(Point origin, StructureMap structures) { if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y)) { return false; } Point origin2; if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(80), new GenCondition[] { new Conditions.IsSolid() }), out origin2)) { return false; } origin2.Y += 2; Ref<int> @ref = new Ref<int>(0); WorldUtils.Gen(origin2, new Shapes.Circle(8), Actions.Chain(new GenAction[] { new Modifiers.IsSolid(), new Actions.Scanner(@ref) })); if (@ref.Value < 20) { return false; } if (!structures.CanPlace(new Rectangle(origin2.X - 8, origin2.Y - 8, 16, 16), 0)) { return false; } WorldUtils.Gen(origin2, new Shapes.Circle(8), Actions.Chain(new GenAction[] { new Modifiers.RadialDither(0f, 10f), new Modifiers.IsSolid(), new Actions.SetTile(229, true, true) })); ShapeData data = new ShapeData(); WorldUtils.Gen(origin2, new Shapes.Circle(4, 3), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.3), new Modifiers.IsSolid(), new Actions.ClearTile(true), new Modifiers.RectangleMask(-6, 6, 0, 3).Output(data), new Actions.SetLiquid(2, 255) })); WorldUtils.Gen(new Point(origin2.X, origin2.Y + 1), new ModShapes.InnerOutline(data, true), Actions.Chain(new GenAction[] { new Modifiers.IsEmpty(), new Modifiers.RectangleMask(-6, 6, 1, 3), new Actions.SetTile(59, true, true) })); structures.AddStructure(new Rectangle(origin2.X - 8, origin2.Y - 8, 16, 16), 0); return true; }
public override bool Place(Point origin, StructureMap structures) { if (WorldGen.SolidTile(origin.X, origin.Y)) return false; ushort type = Utils.SelectRandom<ushort>(GenBase._random, WorldGen.goldBar == 19 ? (ushort)8 : (ushort)169, WorldGen.silverBar == 21 ? (ushort)9 : (ushort)168, WorldGen.ironBar == 22 ? (ushort)6 : (ushort)167, WorldGen.copperBar == 20 ? (ushort)7 : (ushort)166); double num = GenBase._random.NextDouble() * 2.0 - 1.0; if (!WorldUtils.Find(origin, Searches.Chain(num > 0.0 ? (GenSearch)new Searches.Right(40) : (GenSearch)new Searches.Left(40), (GenCondition)new Conditions.IsSolid()), out origin)) return false; if (!WorldUtils.Find(origin, Searches.Chain((GenSearch)new Searches.Down(80), (GenCondition)new Conditions.IsSolid()), out origin)) return false; ShapeData shapeData = new ShapeData(); Ref<int> count1 = new Ref<int>(0); Ref<int> count2 = new Ref<int>(0); WorldUtils.Gen(origin, new ShapeRunner(10f, 20, new Vector2((float)num, 1f)).Output(shapeData), Actions.Chain((GenAction)new Modifiers.Blotches(2, 0.3), (GenAction)new Actions.Scanner(count1), (GenAction)new Modifiers.IsSolid(), (GenAction)new Actions.Scanner(count2))); if (count2.Value < count1.Value / 2) return false; Rectangle area = new Rectangle(origin.X - 15, origin.Y - 10, 30, 20); if (!structures.CanPlace(area, 0)) return false; WorldUtils.Gen(origin, (GenShape)new ModShapes.All(shapeData), (GenAction)new Actions.SetTile(type, true, true)); WorldUtils.Gen(new Point(origin.X - (int)(num * -5.0), origin.Y - 5), (GenShape)new Shapes.Circle(5), Actions.Chain((GenAction)new Modifiers.Blotches(2, 0.3), (GenAction)new Actions.ClearTile(true))); Point result1; Point result2; if (((((true ? 1 : 0) & (WorldUtils.Find(new Point(origin.X - (num > 0.0 ? 3 : -3), origin.Y - 3), Searches.Chain((GenSearch)new Searches.Down(10), (GenCondition)new Conditions.IsSolid()), out result1) ? 1 : 0)) != 0 ? 1 : 0) & (WorldUtils.Find(new Point(origin.X - (num > 0.0 ? -3 : 3), origin.Y - 3), Searches.Chain((GenSearch)new Searches.Down(10), (GenCondition)new Conditions.IsSolid()), out result2) ? 1 : 0)) == 0) return false; --result1.Y; --result2.Y; Tile tile1 = GenBase._tiles[result1.X, result1.Y + 1]; tile1.slope((byte)0); tile1.halfBrick(false); for (int index = -1; index <= 1; ++index) { WorldUtils.ClearTile(result2.X + index, result2.Y, false); Tile tile2 = GenBase._tiles[result2.X + index, result2.Y + 1]; if (!WorldGen.SolidOrSlopedTile(tile2)) { tile2.ResetToType((ushort)1); tile2.active(true); } tile2.slope((byte)0); tile2.halfBrick(false); WorldUtils.TileFrame(result2.X + index, result2.Y + 1, true); } WorldGen.PlaceTile(result1.X, result1.Y, 141, false, false, -1, 0); WorldGen.PlaceTile(result2.X, result2.Y, 411, true, true, -1, 0); WorldUtils.WireLine(result1, result2); structures.AddStructure(area, 5); return true; }
public override bool Place(Point origin, StructureMap structures) { if (!structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X, origin.Y, this._width, this._height), 0)) return false; for (int index1 = 0; index1 < this._width; ++index1) { for (int index2 = 0; index2 < this._height; ++index2) { int num1 = this._xMirror ? -index1 : index1; int num2 = this._yMirror ? -index2 : index2; if (this._data[index1, index2] != -1 && !this._actions[this._data[index1, index2]].Apply(origin, num1 + origin.X, num2 + origin.Y)) return false; } } structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(origin.X, origin.Y, this._width, this._height), 0); return true; }
public override bool Place(Point origin, StructureMap structures) { if (!structures.CanPlace(new Rectangle(origin.X, origin.Y, this._width, this._height), 0)) { return false; } for (int i = 0; i < this._width; i++) { for (int j = 0; j < this._height; j++) { int num = this._xMirror ? (-i) : i; int num2 = this._yMirror ? (-j) : j; if (this._data[i, j] != -1 && !this._actions[this._data[i, j]].Apply(origin, num + origin.X, num2 + origin.Y, new object[0])) { return false; } } } structures.AddStructure(new Rectangle(origin.X, origin.Y, this._width, this._height), 0); return true; }
public override bool Place(Point origin, StructureMap structures) { if (!structures.CanPlace(new Rectangle(origin.X, origin.Y, _width, _height))) { return(false); } for (int i = 0; i < _width; i++) { for (int j = 0; j < _height; j++) { int num = _xMirror ? (-i) : i; int num2 = _yMirror ? (-j) : j; if (_data[i, j] != -1 && !_actions[_data[i, j]].Apply(origin, num + origin.X, num2 + origin.Y)) { return(false); } } } structures.AddStructure(new Rectangle(origin.X, origin.Y, _width, _height)); return(true); }
// Token: 0x06000947 RID: 2375 RVA: 0x003B5784 File Offset: 0x003B3984 public override bool Place(Point origin, StructureMap structures) { if (!structures.CanPlace(new Rectangle(origin.X, origin.Y, this._width, this._height), 0)) { return(false); } for (int i = 0; i < this._width; i++) { for (int j = 0; j < this._height; j++) { int num = this._xMirror ? (-i) : i; int num2 = this._yMirror ? (-j) : j; if (this._data[i, j] != -1 && !this._actions[this._data[i, j]].Apply(origin, num + origin.X, num2 + origin.Y, new object[0])) { return(false); } } } structures.AddStructure(new Rectangle(origin.X, origin.Y, this._width, this._height), 0); return(true); }
public override bool Place(Point origin, StructureMap structures) { Point y; if (GenBase._tiles[origin.X, origin.Y].active() && WorldGen.SolidTile(origin.X, origin.Y)) { return false; } Searches.Down down = new Searches.Down(80); GenCondition[] isSolid = new GenCondition[] { new Conditions.IsSolid() }; if (!WorldUtils.Find(origin, Searches.Chain(down, isSolid), out y)) { return false; } y.Y = y.Y + 2; Ref<int> @ref = new Ref<int>(0); Shapes.Circle circle = new Shapes.Circle(8); GenAction[] genActionArray = new GenAction[] { new Modifiers.IsSolid(), new Actions.Scanner(@ref) }; WorldUtils.Gen(y, circle, Actions.Chain(genActionArray)); if (@ref.Value < 20) { return false; } if (!structures.CanPlace(new Rectangle(y.X - 8, y.Y - 8, 16, 16), 0)) { return false; } Shapes.Circle circle1 = new Shapes.Circle(8); GenAction[] radialDither = new GenAction[] { new Modifiers.RadialDither(0f, 10f), new Modifiers.IsSolid(), new Actions.SetTile(229, true, true) }; WorldUtils.Gen(y, circle1, Actions.Chain(radialDither)); ShapeData shapeDatum = new ShapeData(); Shapes.Circle circle2 = new Shapes.Circle(4, 3); GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(2, 0.3), new Modifiers.IsSolid(), new Actions.ClearTile(true), (new Modifiers.RectangleMask(-6, 6, 0, 3)).Output(shapeDatum), new Actions.SetLiquid(2, 255) }; WorldUtils.Gen(y, circle2, Actions.Chain(blotch)); Point point = new Point(y.X, y.Y + 1); ModShapes.InnerOutline innerOutline = new ModShapes.InnerOutline(shapeDatum, true); GenAction[] isEmpty = new GenAction[] { new Modifiers.IsEmpty(), new Modifiers.RectangleMask(-6, 6, 1, 3), new Actions.SetTile(59, true, true) }; WorldUtils.Gen(point, innerOutline, Actions.Chain(isEmpty)); structures.AddStructure(new Rectangle(y.X - 8, y.Y - 8, 16, 16), 0); return true; }
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; }
public override bool Place(Point origin, StructureMap structures) { Point origin2; if (!WorldUtils.Find(new Point(origin.X - 3, origin.Y), Searches.Chain(new Searches.Down(200), new GenCondition[] { new Conditions.IsSolid().AreaAnd(6, 1) }), out origin2)) { return false; } Point point; bool flag = WorldUtils.Find(new Point(origin2.X, origin2.Y - 5), Searches.Chain(new Searches.Up(120), new GenCondition[] { new Conditions.IsSolid().AreaOr(6, 1) }), out point); if (!flag || origin2.Y - 5 - point.Y > 60) { return false; } if (origin2.Y - point.Y < 30) { return false; } if (!structures.CanPlace(new Rectangle(origin2.X - 30, origin2.Y - 60, 60, 90), 0)) { return false; } Dictionary<ushort, int> dictionary = new Dictionary<ushort, int>(); WorldUtils.Gen(new Point(origin2.X - 25, origin2.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(new ushort[] { 0, 59, 147, 1 }).Output(dictionary)); int num = dictionary[0] + dictionary[1]; int num2 = dictionary[59]; int num3 = dictionary[147]; if (num3 > num2 || num > num2 || num2 < 50) { return false; } int num4 = (origin2.Y - point.Y - 9) / 5; int num5 = num4 * 5; int num6 = 0; double num7 = GenBase._random.NextDouble() + 1.0; double num8 = GenBase._random.NextDouble() + 2.0; if (GenBase._random.Next(2) == 0) { num8 = -num8; } for (int i = 0; i < num4; i++) { double num9 = (double)(i + 1) / 12.0; int num10 = (int)(Math.Sin(num9 * num7 * 3.1415927410125732) * num8); int num11 = (num10 < num6) ? (num10 - num6) : 0; WorldUtils.Gen(new Point(origin2.X + num6 + num11, origin2.Y - (i + 1) * 5), new Shapes.Rectangle(6 + Math.Abs(num10 - num6), 7), Actions.Chain(new GenAction[] { new Actions.RemoveWall(), new Actions.SetTile(383, false, true), new Actions.SetFrames(false) })); WorldUtils.Gen(new Point(origin2.X + num6 + num11 + 2, origin2.Y - (i + 1) * 5), new Shapes.Rectangle(2 + Math.Abs(num10 - num6), 5), Actions.Chain(new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(78, true) })); WorldUtils.Gen(new Point(origin2.X + num6 + 2, origin2.Y - i * 5), new Shapes.Rectangle(2, 2), Actions.Chain(new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(78, true) })); num6 = num10; } int num12 = 6; if (num8 < 0.0) { num12 = 0; } List<Point> list = new List<Point>(); for (int j = 0; j < 2; j++) { double num13 = ((double)j + 1.0) / 3.0; int num14 = num12 + (int)(Math.Sin((double)num4 * num13 / 12.0 * num7 * 3.1415927410125732) * num8); double num15 = GenBase._random.NextDouble() * 0.78539818525314331 - 0.78539818525314331 - 0.20000000298023224; if (num12 == 0) { num15 -= 1.5707963705062866; } WorldUtils.Gen(new Point(origin2.X + num14, origin2.Y - (int)((double)(num4 * 5) * num13)), new ShapeBranch(num15, (double)GenBase._random.Next(12, 16)).OutputEndpoints(list), Actions.Chain(new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) })); num12 = 6 - num12; } int num16 = (int)(Math.Sin((double)num4 / 12.0 * num7 * 3.1415927410125732) * num8); WorldUtils.Gen(new Point(origin2.X + 6 + num16, origin2.Y - num5), new ShapeBranch(-0.68539818525314333, (double)GenBase._random.Next(16, 22)).OutputEndpoints(list), Actions.Chain(new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) })); WorldUtils.Gen(new Point(origin2.X + num16, origin2.Y - num5), new ShapeBranch(-2.45619455575943, (double)GenBase._random.Next(16, 22)).OutputEndpoints(list), Actions.Chain(new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) })); foreach (Point current in list) { WorldUtils.Gen(current, new Shapes.Circle(4), Actions.Chain(new GenAction[] { new Modifiers.Blotches(4, 2, 0.3), new Modifiers.SkipTiles(new ushort[] { 383 }), new Modifiers.SkipWalls(new byte[] { 78 }), new Actions.SetTile(384, false, true), new Actions.SetFrames(true) })); } for (int k = 0; k < 4; k++) { float angle = (float)k / 3f * 2f + 0.57075f; WorldUtils.Gen(origin2, new ShapeRoot(angle, (float)GenBase._random.Next(40, 60), 4f, 1f), new Actions.SetTile(383, true, true)); } WorldGen.AddBuriedChest(origin2.X + 3, origin2.Y - 1, (GenBase._random.Next(4) == 0) ? 0 : WorldGen.GetNextJungleChestItem(), false, 10); structures.AddStructure(new Rectangle(origin2.X - 30, origin2.Y - 30, 60, 60), 0); return true; }
public override bool Place(Point origin, StructureMap structures) { Point y; Point point; Dictionary<ushort, int> nums = new Dictionary<ushort, int>(); Point point1 = new Point(origin.X - 25, origin.Y - 25); Shapes.Rectangle rectangle = new Shapes.Rectangle(50, 50); ushort[] numArray = new ushort[] { 0, 1 }; WorldUtils.Gen(point1, rectangle, (new Actions.TileScanner(numArray)).Output(nums)); if (nums[0] + nums[1] < 1250) { return false; } Searches.Up up = new Searches.Up(1000); GenCondition[] genConditionArray = new GenCondition[] { (new Conditions.IsSolid()).AreaOr(1, 50).Not() }; bool flag = WorldUtils.Find(origin, Searches.Chain(up, genConditionArray), out y); Point point2 = origin; Searches.Up up1 = new Searches.Up(origin.Y - y.Y); GenCondition[] isTile = new GenCondition[1]; ushort[] numArray1 = new ushort[] { 53 }; isTile[0] = new Conditions.IsTile(numArray1); if (WorldUtils.Find(point2, Searches.Chain(up1, isTile), out point)) { return false; } if (!flag) { return false; } y.Y = y.Y + 50; ShapeData shapeDatum = new ShapeData(); ShapeData shapeDatum1 = new ShapeData(); Point point3 = new Point(origin.X, origin.Y + 20); Point point4 = new Point(origin.X, origin.Y + 30); float single = 0.8f + GenBase._random.NextFloat() * 0.5f; if (!structures.CanPlace(new Rectangle(point3.X - (int)(20f * single), point3.Y - 20, (int)(40f * single), 40), 0)) { return false; } if (!structures.CanPlace(new Rectangle(origin.X, y.Y + 10, 1, origin.Y - y.Y - 9), 2)) { return false; } Shapes.Slime slime = new Shapes.Slime(20, single, 1f); GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(2, 0.4), (new Actions.ClearTile(true)).Output(shapeDatum) }; WorldUtils.Gen(point3, slime, Actions.Chain(blotch)); Shapes.Mound mound = new Shapes.Mound(14, 14); GenAction[] genActionArray = new GenAction[] { new Modifiers.Blotches(2, 1, 0.8), new Actions.SetTile(0, false, true), (new Actions.SetFrames(true)).Output(shapeDatum1) }; WorldUtils.Gen(point4, mound, Actions.Chain(genActionArray)); shapeDatum.Subtract(shapeDatum1, point3, point4); ModShapes.InnerOutline innerOutline = new ModShapes.InnerOutline(shapeDatum, true); GenAction[] setTile = new GenAction[] { new Actions.SetTile(2, false, true), new Actions.SetFrames(true) }; WorldUtils.Gen(point3, innerOutline, Actions.Chain(setTile)); ModShapes.All all = new ModShapes.All(shapeDatum); GenAction[] rectangleMask = new GenAction[] { new Modifiers.RectangleMask(-40, 40, 0, 40), new Modifiers.IsEmpty(), new Actions.SetLiquid(0, 255) }; WorldUtils.Gen(point3, all, Actions.Chain(rectangleMask)); ModShapes.All all1 = new ModShapes.All(shapeDatum); GenAction[] placeWall = new GenAction[] { new Actions.PlaceWall(68, true), null, null, null }; ushort[] numArray2 = new ushort[] { 2 }; placeWall[1] = new Modifiers.OnlyTiles(numArray2); placeWall[2] = new Modifiers.Offset(0, 1); placeWall[3] = new ActionVines(3, 5, 52); WorldUtils.Gen(point3, all1, Actions.Chain(placeWall)); ShapeData shapeDatum2 = new ShapeData(); Point point5 = new Point(origin.X, y.Y + 10); Shapes.Rectangle rectangle1 = new Shapes.Rectangle(1, origin.Y - y.Y - 9); GenAction[] onlyTile = new GenAction[] { new Modifiers.Blotches(2, 0.2), (new Actions.ClearTile(false)).Output(shapeDatum2), new Modifiers.Expand(1), null, null }; ushort[] numArray3 = new ushort[] { 53 }; onlyTile[3] = new Modifiers.OnlyTiles(numArray3); onlyTile[4] = (new Actions.SetTile(397, false, true)).Output(shapeDatum2); WorldUtils.Gen(point5, rectangle1, Actions.Chain(onlyTile)); WorldUtils.Gen(new Point(origin.X, y.Y + 10), new ModShapes.All(shapeDatum2), new Actions.SetFrames(true)); if (GenBase._random.Next(3) != 0) { WorldGen.PlaceTile(point4.X, point4.Y - 15, 186, true, false, -1, 15); } else { WorldGen.PlaceTile(point4.X, point4.Y - 15, 187, true, false, -1, 17); } ModShapes.All all2 = new ModShapes.All(shapeDatum1); GenAction[] offset = new GenAction[] { new Modifiers.Offset(0, -1), null, null, null }; ushort[] numArray4 = new ushort[] { 2 }; offset[1] = new Modifiers.OnlyTiles(numArray4); offset[2] = new Modifiers.Offset(0, -1); offset[3] = new ActionGrass(); WorldUtils.Gen(point4, all2, Actions.Chain(offset)); structures.AddStructure(new Rectangle(point3.X - (int)(20f * single), point3.Y - 20, (int)(40f * single), 40), 4); return true; }
public override bool Place(Point origin, StructureMap structures) { Point point; if (WorldGen.SolidTile(origin.X, origin.Y) && GenBase._tiles[origin.X, origin.Y].wall == 3) { return false; } Searches.Down down = new Searches.Down(100); GenCondition[] isSolid = new GenCondition[] { new Conditions.IsSolid() }; if (!WorldUtils.Find(origin, Searches.Chain(down, isSolid), out origin)) { return false; } Point point1 = new Point(origin.X - 4, origin.Y); Searches.Down down1 = new Searches.Down(5); GenCondition[] genConditionArray = new GenCondition[1]; ushort[] numArray = new ushort[] { 25 }; genConditionArray[0] = (new Conditions.IsTile(numArray)).AreaAnd(8, 1); if (!WorldUtils.Find(point1, Searches.Chain(down1, genConditionArray), out point)) { return false; } ShapeData shapeDatum = new ShapeData(); ShapeData shapeDatum1 = new ShapeData(); ShapeData shapeDatum2 = new ShapeData(); for (int i = 0; i < 6; i++) { Shapes.Circle circle = new Shapes.Circle(GenBase._random.Next(10, 12) + i); GenAction[] offset = new GenAction[] { new Modifiers.Offset(0, 5 * i + 5), (new Modifiers.Blotches(3, 0.3)).Output(shapeDatum) }; WorldUtils.Gen(origin, circle, Actions.Chain(offset)); } for (int j = 0; j < 6; j++) { Shapes.Circle circle1 = new Shapes.Circle(GenBase._random.Next(5, 7) + j); GenAction[] genActionArray = new GenAction[] { new Modifiers.Offset(0, 2 * j + 18), (new Modifiers.Blotches(3, 0.3)).Output(shapeDatum1) }; WorldUtils.Gen(origin, circle1, Actions.Chain(genActionArray)); } for (int k = 0; k < 6; k++) { Shapes.Circle circle2 = new Shapes.Circle(GenBase._random.Next(4, 6) + k / 2); GenAction[] offset1 = new GenAction[] { new Modifiers.Offset(0, (int)(7.5f * (float)k) - 10), (new Modifiers.Blotches(3, 0.3)).Output(shapeDatum2) }; WorldUtils.Gen(origin, circle2, Actions.Chain(offset1)); } ShapeData shapeDatum3 = new ShapeData(shapeDatum1); shapeDatum1.Subtract(shapeDatum2, origin, origin); shapeDatum3.Subtract(shapeDatum1, origin, origin); ShapeData[] shapeDataArray = new ShapeData[] { shapeDatum, shapeDatum2 }; Rectangle bounds = ShapeData.GetBounds(origin, shapeDataArray); if (!structures.CanPlace(bounds, CorruptionPitBiome.ValidTiles, 2)) { return false; } ModShapes.All all = new ModShapes.All(shapeDatum); GenAction[] setTile = new GenAction[] { new Actions.SetTile(25, true, true), new Actions.PlaceWall(3, true) }; WorldUtils.Gen(origin, all, Actions.Chain(setTile)); WorldUtils.Gen(origin, new ModShapes.All(shapeDatum1), new Actions.SetTile(0, true, true)); WorldUtils.Gen(origin, new ModShapes.All(shapeDatum2), new Actions.ClearTile(true)); ModShapes.All all1 = new ModShapes.All(shapeDatum1); GenAction[] isTouchingAir = new GenAction[] { new Modifiers.IsTouchingAir(true), null, null }; ushort[] numArray1 = new ushort[] { 25 }; isTouchingAir[1] = new Modifiers.NotTouching(false, numArray1); isTouchingAir[2] = new Actions.SetTile(23, true, true); WorldUtils.Gen(origin, all1, Actions.Chain(isTouchingAir)); WorldUtils.Gen(origin, new ModShapes.All(shapeDatum3), new Actions.PlaceWall(69, true)); structures.AddStructure(bounds, 2); return true; }
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 GenCondition[] { new Conditions.IsSolid() }), out origin)) { return false; } Point point; if (!WorldUtils.Find(new Point(origin.X - 4, origin.Y), Searches.Chain(new Searches.Down(5), new GenCondition[] { new Conditions.IsTile(new ushort[] { 25 }).AreaAnd(8, 1) }), out point)) { return false; } ShapeData shapeData = new ShapeData(); ShapeData shapeData2 = new ShapeData(); ShapeData shapeData3 = new ShapeData(); for (int i = 0; i < 6; i++) { WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(10, 12) + i), Actions.Chain(new GenAction[] { new Modifiers.Offset(0, 5 * i + 5), new Modifiers.Blotches(3, 0.3).Output(shapeData) })); } for (int j = 0; j < 6; j++) { WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(5, 7) + j), Actions.Chain(new GenAction[] { new Modifiers.Offset(0, 2 * j + 18), new Modifiers.Blotches(3, 0.3).Output(shapeData2) })); } for (int k = 0; k < 6; k++) { WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(4, 6) + k / 2), Actions.Chain(new GenAction[] { new Modifiers.Offset(0, (int)(7.5f * (float)k) - 10), new Modifiers.Blotches(3, 0.3).Output(shapeData3) })); } ShapeData shapeData4 = new ShapeData(shapeData2); shapeData2.Subtract(shapeData3, origin, origin); shapeData4.Subtract(shapeData2, origin, origin); Rectangle bounds = ShapeData.GetBounds(origin, new ShapeData[] { shapeData, shapeData3 }); if (!structures.CanPlace(bounds, CorruptionPitBiome.ValidTiles, 2)) { return false; } WorldUtils.Gen(origin, new ModShapes.All(shapeData), Actions.Chain(new GenAction[] { new Actions.SetTile(25, true, true), new Actions.PlaceWall(3, true) })); WorldUtils.Gen(origin, new ModShapes.All(shapeData2), new Actions.SetTile(0, true, true)); WorldUtils.Gen(origin, new ModShapes.All(shapeData3), new Actions.ClearTile(true)); WorldUtils.Gen(origin, new ModShapes.All(shapeData2), Actions.Chain(new GenAction[] { new Modifiers.IsTouchingAir(true), new Modifiers.NotTouching(false, new ushort[] { 25 }), new Actions.SetTile(23, true, true) })); WorldUtils.Gen(origin, new ModShapes.All(shapeData4), new Actions.PlaceWall(69, true)); structures.AddStructure(bounds, 2); return true; }
public override bool Place(Point origin, StructureMap structures) { Point point; bool flag = WorldUtils.Find(origin, Searches.Chain(new Searches.Down(200), new GenCondition[] { new Conditions.IsSolid() }), out point); if (!flag || point == origin) { return false; } Rectangle room = this.GetRoom(point); Rectangle rectangle = this.GetRoom(new Point(room.Center.X, room.Y + 1)); Rectangle rectangle2 = this.GetRoom(new Point(room.Center.X, room.Y + room.Height + 10)); rectangle2.Y = room.Y + room.Height - 1; float num = this.RoomSolidPrecentage(rectangle); float num2 = this.RoomSolidPrecentage(rectangle2); room.Y += 3; rectangle.Y += 3; rectangle2.Y += 3; List<Rectangle> list = new List<Rectangle>(); if (GenBase._random.NextFloat() > num + 0.2f) { list.Add(rectangle); } else { rectangle = room; } list.Add(room); if (GenBase._random.NextFloat() > num2 + 0.2f) { list.Add(rectangle2); } else { rectangle2 = room; } Dictionary<ushort, int> dictionary = new Dictionary<ushort, int>(); foreach (Rectangle current in list) { WorldUtils.Gen(new Point(current.X - 5, current.Y - 5), new Shapes.Rectangle(current.Width + 10, current.Height + 10), new Actions.TileScanner(new ushort[] { 0, 59, 147, 1, 161, 53, 396, 397, 368, 367, 60, 70 }).Output(dictionary)); } List<Tuple<CaveHouseBiome.BuildData, int>> list2 = new List<Tuple<CaveHouseBiome.BuildData, int>>(); list2.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Default, dictionary[0] + dictionary[1])); list2.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Jungle, dictionary[59] + dictionary[60] * 10)); list2.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Mushroom, dictionary[59] + dictionary[70] * 10)); list2.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Snow, dictionary[147] + dictionary[161])); list2.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Desert, dictionary[397] + dictionary[396] + dictionary[53])); list2.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Granite, dictionary[368])); list2.Add(Tuple.Create<CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Marble, dictionary[367])); list2.Sort(new Comparison<Tuple<CaveHouseBiome.BuildData, int>>(this.SortBiomeResults)); CaveHouseBiome.BuildData item = list2[0].Item1; foreach (Rectangle current2 in list) { if (item != CaveHouseBiome.BuildData.Granite) { Point point2; bool flag2 = WorldUtils.Find(new Point(current2.X - 2, current2.Y - 2), Searches.Chain(new Searches.Rectangle(current2.Width + 4, current2.Height + 4).RequireAll(false), new GenCondition[] { new Conditions.HasLava() }), out point2); if (flag2) { bool result = false; return result; } } if (!structures.CanPlace(current2, CaveHouseBiome._blacklistedTiles, 5)) { bool result = false; return result; } } int num3 = room.X; int num4 = room.X + room.Width - 1; List<Rectangle> list3 = new List<Rectangle>(); foreach (Rectangle current3 in list) { num3 = Math.Min(num3, current3.X); num4 = Math.Max(num4, current3.X + current3.Width - 1); } int num5 = 6; while (num5 > 4 && (num4 - num3) % num5 != 0) { num5--; } for (int i = num3; i <= num4; i += num5) { for (int j = 0; j < list.Count; j++) { Rectangle rectangle3 = list[j]; if (i >= rectangle3.X && i < rectangle3.X + rectangle3.Width) { int num6 = rectangle3.Y + rectangle3.Height; int num7 = 50; for (int k = j + 1; k < list.Count; k++) { if (i >= list[k].X && i < list[k].X + list[k].Width) { num7 = Math.Min(num7, list[k].Y - num6); } } if (num7 > 0) { Point point3; bool flag3 = WorldUtils.Find(new Point(i, num6), Searches.Chain(new Searches.Down(num7), new GenCondition[] { new Conditions.IsSolid() }), out point3); if (num7 < 50) { flag3 = true; point3 = new Point(i, num6 + num7); } if (flag3) { list3.Add(new Rectangle(i, num6, 1, point3.Y - num6)); } } } } } List<Point> list4 = new List<Point>(); foreach (Rectangle current4 in list) { int num8; bool flag4 = this.FindSideExit(new Rectangle(current4.X + current4.Width, current4.Y + 1, 1, current4.Height - 2), false, out num8); if (flag4) { list4.Add(new Point(current4.X + current4.Width - 1, num8)); } flag4 = this.FindSideExit(new Rectangle(current4.X, current4.Y + 1, 1, current4.Height - 2), true, out num8); if (flag4) { list4.Add(new Point(current4.X, num8)); } } List<Tuple<Point, Point>> list5 = new List<Tuple<Point, Point>>(); for (int l = 1; l < list.Count; l++) { Rectangle rectangle4 = list[l]; Rectangle rectangle5 = list[l - 1]; int num9 = rectangle5.X - rectangle4.X; int num10 = rectangle4.X + rectangle4.Width - (rectangle5.X + rectangle5.Width); if (num9 > num10) { list5.Add(new Tuple<Point, Point>(new Point(rectangle4.X + rectangle4.Width - 1, rectangle4.Y + 1), new Point(rectangle4.X + rectangle4.Width - rectangle4.Height + 1, rectangle4.Y + rectangle4.Height - 1))); } else { list5.Add(new Tuple<Point, Point>(new Point(rectangle4.X, rectangle4.Y + 1), new Point(rectangle4.X + rectangle4.Height - 1, rectangle4.Y + rectangle4.Height - 1))); } } List<Point> list6 = new List<Point>(); int num11; bool flag5 = this.FindVerticalExit(new Rectangle(rectangle.X + 2, rectangle.Y, rectangle.Width - 4, 1), true, out num11); if (flag5) { list6.Add(new Point(num11, rectangle.Y)); } flag5 = this.FindVerticalExit(new Rectangle(rectangle2.X + 2, rectangle2.Y + rectangle2.Height - 1, rectangle2.Width - 4, 1), false, out num11); if (flag5) { list6.Add(new Point(num11, rectangle2.Y + rectangle2.Height - 1)); } foreach (Rectangle current5 in list) { WorldUtils.Gen(new Point(current5.X, current5.Y), new Shapes.Rectangle(current5.Width, current5.Height), Actions.Chain(new GenAction[] { new Actions.SetTile(item.Tile, false, true), new Actions.SetFrames(true) })); WorldUtils.Gen(new Point(current5.X + 1, current5.Y + 1), new Shapes.Rectangle(current5.Width - 2, current5.Height - 2), Actions.Chain(new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(item.Wall, true) })); structures.AddStructure(current5, 8); } foreach (Tuple<Point, Point> current6 in list5) { Point item2 = current6.Item1; Point item3 = current6.Item2; int num12 = (item3.X > item2.X) ? 1 : -1; ShapeData shapeData = new ShapeData(); for (int m = 0; m < item3.Y - item2.Y; m++) { shapeData.Add(num12 * (m + 1), m); } WorldUtils.Gen(item2, new ModShapes.All(shapeData), Actions.Chain(new GenAction[] { new Actions.PlaceTile(19, item.PlatformStyle), new Actions.SetSlope((num12 == 1) ? 1 : 2), new Actions.SetFrames(true) })); WorldUtils.Gen(new Point(item2.X + ((num12 == 1) ? 1 : -4), item2.Y - 1), new Shapes.Rectangle(4, 1), Actions.Chain(new GenAction[] { new Actions.Clear(), new Actions.PlaceWall(item.Wall, true), new Actions.PlaceTile(19, item.PlatformStyle), new Actions.SetFrames(true) })); } foreach (Point current7 in list4) { WorldUtils.Gen(current7, new Shapes.Rectangle(1, 3), new Actions.ClearTile(true)); WorldGen.PlaceTile(current7.X, current7.Y, 10, true, true, -1, item.DoorStyle); } foreach (Point current8 in list6) { WorldUtils.Gen(current8, new Shapes.Rectangle(3, 1), Actions.Chain(new GenAction[] { new Actions.ClearMetadata(), new Actions.PlaceTile(19, item.PlatformStyle), new Actions.SetFrames(true) })); } foreach (Rectangle current9 in list3) { if (current9.Height > 1 && GenBase._tiles[current9.X, current9.Y - 1].type != 19) { WorldUtils.Gen(new Point(current9.X, current9.Y), new Shapes.Rectangle(current9.Width, current9.Height), Actions.Chain(new GenAction[] { new Actions.SetTile(124, false, true), new Actions.SetFrames(true) })); Tile tile = GenBase._tiles[current9.X, current9.Y + current9.Height]; tile.slope(0); tile.halfBrick(false); } } Point[] choices = new Point[] { new Point(14, item.TableStyle), new Point(16, 0), new Point(18, item.WorkbenchStyle), new Point(86, 0), new Point(87, item.PianoStyle), new Point(94, 0), new Point(101, item.BookcaseStyle) }; foreach (Rectangle current10 in list) { int num13 = current10.Width / 8; int num14 = current10.Width / (num13 + 1); int num15 = GenBase._random.Next(2); for (int n = 0; n < num13; n++) { int num16 = (n + 1) * num14 + current10.X; switch (n + num15 % 2) { case 0: { int num17 = current10.Y + Math.Min(current10.Height / 2, current10.Height - 5); Vector2 vector = WorldGen.randHousePicture(); int type = (int)vector.X; int style = (int)vector.Y; if (!WorldGen.nearPicture(num16, num17)) { WorldGen.PlaceTile(num16, num17, type, true, false, -1, style); } break; } case 1: { int num17 = current10.Y + 1; WorldGen.PlaceTile(num16, num17, 34, true, false, -1, GenBase._random.Next(6)); for (int num18 = -1; num18 < 2; num18++) { for (int num19 = 0; num19 < 3; num19++) { Tile expr_E29 = GenBase._tiles[num18 + num16, num19 + num17]; expr_E29.frameX += 54; } } break; } } } int num20 = current10.Width / 8 + 3; WorldGen.SetupStatueList(); while (num20 > 0) { int num21 = GenBase._random.Next(current10.Width - 3) + 1 + current10.X; int num22 = current10.Y + current10.Height - 2; switch (GenBase._random.Next(4)) { case 0: WorldGen.PlaceSmallPile(num21, num22, GenBase._random.Next(31, 34), 1, 185); break; case 1: WorldGen.PlaceTile(num21, num22, 186, true, false, -1, GenBase._random.Next(22, 26)); break; case 2: { int num23 = GenBase._random.Next(2, WorldGen.statueList.Length); WorldGen.PlaceTile(num21, num22, (int)WorldGen.statueList[num23].X, true, false, -1, (int)WorldGen.statueList[num23].Y); if (WorldGen.StatuesWithTraps.Contains(num23)) { WorldGen.PlaceStatueTrap(num21, num22); } break; } case 3: { Point point4 = Utils.SelectRandom<Point>(GenBase._random, choices); WorldGen.PlaceTile(num21, num22, point4.X, true, false, -1, point4.Y); break; } } num20--; } } foreach (Rectangle current11 in list) { item.ProcessRoom(current11); } bool flag6 = false; foreach (Rectangle current12 in list) { int num24 = current12.Height - 1 + current12.Y; int style2 = (num24 > (int)Main.worldSurface) ? item.ChestStyle : 0; for (int num25 = 0; num25 < 10; num25++) { int i2 = GenBase._random.Next(2, current12.Width - 2) + current12.X; if (flag6 = WorldGen.AddBuriedChest(i2, num24, 0, false, style2)) { break; } } if (flag6) { break; } int num26 = current12.X + 2; while (num26 <= current12.X + current12.Width - 2 && !(flag6 = WorldGen.AddBuriedChest(num26, num24, 0, false, style2))) { num26++; } if (flag6) { break; } } if (!flag6) { foreach (Rectangle current13 in list) { int num27 = current13.Y - 1; int style3 = (num27 > (int)Main.worldSurface) ? item.ChestStyle : 0; for (int num28 = 0; num28 < 10; num28++) { int i3 = GenBase._random.Next(2, current13.Width - 2) + current13.X; if (flag6 = WorldGen.AddBuriedChest(i3, num27, 0, false, style3)) { break; } } if (flag6) { break; } int num29 = current13.X + 2; while (num29 <= current13.X + current13.Width - 2 && !(flag6 = WorldGen.AddBuriedChest(num29, num27, 0, false, style3))) { num29++; } if (flag6) { break; } } } if (!flag6) { for (int num30 = 0; num30 < 1000; num30++) { int i4 = GenBase._random.Next(list[0].X - 30, list[0].X + 30); int num31 = GenBase._random.Next(list[0].Y - 30, list[0].Y + 30); int style4 = (num31 > (int)Main.worldSurface) ? item.ChestStyle : 0; if (flag6 = WorldGen.AddBuriedChest(i4, num31, 0, false, style4)) { break; } } } if (item == CaveHouseBiome.BuildData.Jungle && this._sharpenerCount < GenBase._random.Next(2, 5)) { bool flag7 = false; foreach (Rectangle current14 in list) { int num32 = current14.Height - 2 + current14.Y; for (int num33 = 0; num33 < 10; num33++) { int num34 = GenBase._random.Next(2, current14.Width - 2) + current14.X; WorldGen.PlaceTile(num34, num32, 377, true, true, -1, 0); if (flag7 = (GenBase._tiles[num34, num32].active() && GenBase._tiles[num34, num32].type == 377)) { break; } } if (flag7) { break; } int num35 = current14.X + 2; while (num35 <= current14.X + current14.Width - 2 && !(flag7 = WorldGen.PlaceTile(num35, num32, 377, true, true, -1, 0))) { num35++; } if (flag7) { break; } } if (flag7) { this._sharpenerCount++; } } if (item == CaveHouseBiome.BuildData.Desert && this._extractinatorCount < GenBase._random.Next(2, 5)) { bool flag8 = false; foreach (Rectangle current15 in list) { int num36 = current15.Height - 2 + current15.Y; for (int num37 = 0; num37 < 10; num37++) { int num38 = GenBase._random.Next(2, current15.Width - 2) + current15.X; WorldGen.PlaceTile(num38, num36, 219, true, true, -1, 0); if (flag8 = (GenBase._tiles[num38, num36].active() && GenBase._tiles[num38, num36].type == 219)) { break; } } if (flag8) { break; } int num39 = current15.X + 2; while (num39 <= current15.X + current15.Width - 2 && !(flag8 = WorldGen.PlaceTile(num39, num36, 219, true, true, -1, 0))) { num39++; } if (flag8) { break; } } if (flag8) { this._extractinatorCount++; } } return true; }
public override bool Place(Point origin, StructureMap structures) { Ref<int> @ref = new Ref<int>(0); Ref<int> ref2 = new Ref<int>(0); Ref<int> count = new Ref<int>(0); Ref<int> ref3 = new Ref<int>(0); WorldUtils.Gen(origin, new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Actions.Scanner(count), new Modifiers.IsSolid(), new Actions.Scanner(@ref), new Modifiers.OnlyTiles(new ushort[] { 60, 59 }), new Actions.Scanner(ref2), new Modifiers.OnlyTiles(new ushort[] { 60 }), new Actions.Scanner(ref3) })); if ((float)ref2.Value / (float)@ref.Value < 0.75f || ref3.Value < 2) { return false; } if (!structures.CanPlace(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 0)) { return false; } int x = origin.X; int y = origin.Y; int num = 150; for (int i = x - num; i < x + num; i += 10) { if (i > 0 && i <= Main.maxTilesX - 1) { for (int j = y - num; j < y + num; j += 10) { if (j > 0 && j <= Main.maxTilesY - 1) { if (Main.tile[i, j].active() && Main.tile[i, j].type == 226) { return false; } if (Main.tile[i, j].wall == 87 || Main.tile[i, j].wall == 3 || Main.tile[i, j].wall == 83) { return false; } } } } } int x2 = origin.X; int y2 = origin.Y; int num2 = 0; int[] array = new int[10]; int[] array2 = new int[10]; Vector2 vector = new Vector2((float)x2, (float)y2); Vector2 vector2 = vector; int num3 = WorldGen.genRand.Next(2, 5); for (int k = 0; k < num3; k++) { int num4 = WorldGen.genRand.Next(2, 5); for (int l = 0; l < num4; l++) { vector2 = WorldGen.Hive((int)vector.X, (int)vector.Y); } vector = vector2; array[num2] = (int)vector.X; array2[num2] = (int)vector.Y; num2++; } for (int m = 0; m < num2; m++) { int num5 = array[m]; int num6 = array2[m]; bool flag = false; int num7 = 1; if (WorldGen.genRand.Next(2) == 0) { num7 = -1; } while (num5 > 10 && num5 < Main.maxTilesX - 10 && num6 > 10 && num6 < Main.maxTilesY - 10 && (!Main.tile[num5, num6].active() || !Main.tile[num5, num6 + 1].active() || !Main.tile[num5 + 1, num6].active() || !Main.tile[num5 + 1, num6 + 1].active())) { num5 += num7; if (Math.Abs(num5 - array[m]) > 50) { flag = true; break; } } if (!flag) { num5 += num7; for (int n = num5 - 1; n <= num5 + 2; n++) { for (int num8 = num6 - 1; num8 <= num6 + 2; num8++) { if (n < 10 || n > Main.maxTilesX - 10) { flag = true; } else if (Main.tile[n, num8].active() && Main.tile[n, num8].type != 225) { flag = true; break; } } } if (!flag) { for (int num9 = num5 - 1; num9 <= num5 + 2; num9++) { for (int num10 = num6 - 1; num10 <= num6 + 2; num10++) { if (num9 >= num5 && num9 <= num5 + 1 && num10 >= num6 && num10 <= num6 + 1) { Main.tile[num9, num10].active(false); Main.tile[num9, num10].liquid = 255; Main.tile[num9, num10].honey(true); } else { Main.tile[num9, num10].active(true); Main.tile[num9, num10].type = 225; } } } num7 *= -1; num6++; int num11 = 0; while ((num11 < 4 || WorldGen.SolidTile(num5, num6)) && num5 > 10 && num5 < Main.maxTilesX - 10) { num11++; num5 += num7; if (WorldGen.SolidTile(num5, num6)) { WorldGen.PoundTile(num5, num6); if (!Main.tile[num5, num6 + 1].active()) { Main.tile[num5, num6 + 1].active(true); Main.tile[num5, num6 + 1].type = 225; } } } } } } WorldGen.larvaX[WorldGen.numLarva] = Utils.Clamp<int>((int)vector.X, 5, Main.maxTilesX - 5); WorldGen.larvaY[WorldGen.numLarva] = Utils.Clamp<int>((int)vector.Y, 5, Main.maxTilesY - 5); WorldGen.numLarva++; int num12 = (int)vector.X; int num13 = (int)vector.Y; int num14 = num12 - 1; while (num14 <= num12 + 1 && num14 > 0 && num14 < Main.maxTilesX) { int num15 = num13 - 2; while (num15 <= num13 + 1 && num15 > 0 && num15 < Main.maxTilesY) { if (num15 != num13 + 1) { Main.tile[num14, num15].active(false); } else { Main.tile[num14, num15].active(true); Main.tile[num14, num15].type = 225; Main.tile[num14, num15].slope(0); Main.tile[num14, num15].halfBrick(false); } num15++; } num14++; } structures.AddStructure(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5); return true; }
public override bool Place(Point origin, StructureMap structures) { Ref<int> @ref = new Ref<int>(0); Ref<int> ref1 = new Ref<int>(0); Ref<int> ref2 = new Ref<int>(0); Ref<int> ref3 = new Ref<int>(0); Shapes.Circle circle = new Shapes.Circle(15); GenAction[] scanner = new GenAction[] { new Actions.Scanner(ref2), new Modifiers.IsSolid(), new Actions.Scanner(@ref), null, null, null, null }; ushort[] numArray = new ushort[] { 60, 59 }; scanner[3] = new Modifiers.OnlyTiles(numArray); scanner[4] = new Actions.Scanner(ref1); ushort[] numArray1 = new ushort[] { 60 }; scanner[5] = new Modifiers.OnlyTiles(numArray1); scanner[6] = new Actions.Scanner(ref3); WorldUtils.Gen(origin, circle, Actions.Chain(scanner)); if ((float)ref1.Value / (float)@ref.Value < 0.75f || ref3.Value < 2) { return false; } if (!structures.CanPlace(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 0)) { return false; } int x = origin.X; int y = origin.Y; int num = 150; for (int i = x - num; i < x + num; i = i + 10) { if (i > 0 && i <= Main.maxTilesX - 1) { for (int j = y - num; j < y + num; j = j + 10) { if (j > 0 && j <= Main.maxTilesY - 1) { if (Main.tile[i, j].active() && Main.tile[i, j].type == 226) { return false; } if (Main.tile[i, j].wall == 87 || Main.tile[i, j].wall == 3 || Main.tile[i, j].wall == 83) { return false; } } } } } int x1 = origin.X; int y1 = origin.Y; int num1 = 0; int[] x2 = new int[10]; int[] y2 = new int[10]; Vector2 vector2 = new Vector2((float)x1, (float)y1); Vector2 vector21 = vector2; int num2 = WorldGen.genRand.Next(2, 5); for (int k = 0; k < num2; k++) { int num3 = WorldGen.genRand.Next(2, 5); for (int l = 0; l < num3; l++) { vector21 = WorldGen.Hive((int)vector2.X, (int)vector2.Y); } vector2 = vector21; x2[num1] = (int)vector2.X; y2[num1] = (int)vector2.Y; num1++; } for (int m = 0; m < num1; m++) { int num4 = x2[m]; int num5 = y2[m]; bool flag = false; int num6 = 1; if (WorldGen.genRand.Next(2) == 0) { num6 = -1; } while (num4 > 10 && num4 < Main.maxTilesX - 10 && num5 > 10 && num5 < Main.maxTilesY - 10 && (!Main.tile[num4, num5].active() || !Main.tile[num4, num5 + 1].active() || !Main.tile[num4 + 1, num5].active() || !Main.tile[num4 + 1, num5 + 1].active())) { num4 = num4 + num6; if (Math.Abs(num4 - x2[m]) <= 50) { continue; } flag = true; break; } if (!flag) { num4 = num4 + num6; for (int n = num4 - 1; n <= num4 + 2; n++) { for (int o = num5 - 1; o <= num5 + 2; o++) { if (n < 10 || n > Main.maxTilesX - 10) { flag = true; } else if (Main.tile[n, o].active() && Main.tile[n, o].type != 225) { flag = true; break; } } } if (!flag) { for (int p = num4 - 1; p <= num4 + 2; p++) { for (int q = num5 - 1; q <= num5 + 2; q++) { if (p < num4 || p > num4 + 1 || q < num5 || q > num5 + 1) { Main.tile[p, q].active(true); Main.tile[p, q].type = 225; } else { Main.tile[p, q].active(false); Main.tile[p, q].liquid = 255; Main.tile[p, q].honey(true); } } } num6 = num6 * -1; num5++; int num7 = 0; while ((num7 < 4 || WorldGen.SolidTile(num4, num5)) && num4 > 10 && num4 < Main.maxTilesX - 10) { num7++; num4 = num4 + num6; if (!WorldGen.SolidTile(num4, num5)) { continue; } WorldGen.PoundTile(num4, num5); if (Main.tile[num4, num5 + 1].active()) { continue; } Main.tile[num4, num5 + 1].active(true); Main.tile[num4, num5 + 1].type = 225; } } } } WorldGen.larvaX[WorldGen.numLarva] = Utils.Clamp<int>((int)vector2.X, 5, Main.maxTilesX - 5); WorldGen.larvaY[WorldGen.numLarva] = Utils.Clamp<int>((int)vector2.Y, 5, Main.maxTilesY - 5); WorldGen.numLarva = WorldGen.numLarva + 1; int x3 = (int)vector2.X; int y3 = (int)vector2.Y; for (int r = x3 - 1; r <= x3 + 1 && r > 0 && r < Main.maxTilesX; r++) { for (int s = y3 - 2; s <= y3 + 1 && s > 0 && s < Main.maxTilesY; s++) { if (s == y3 + 1) { Main.tile[r, s].active(true); Main.tile[r, s].type = 225; Main.tile[r, s].slope(0); Main.tile[r, s].halfBrick(false); } else { Main.tile[r, s].active(false); } } } structures.AddStructure(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5); return true; }
public override bool Place(Point origin, StructureMap structures) { Point point; Point point1; Point point2 = new Point(origin.X - 3, origin.Y); Searches.Down down = new Searches.Down(200); GenCondition[] genConditionArray = new GenCondition[] { (new Conditions.IsSolid()).AreaAnd(6, 1) }; if (!WorldUtils.Find(point2, Searches.Chain(down, genConditionArray), out point)) { return false; } Point point3 = new Point(point.X, point.Y - 5); Searches.Up up = new Searches.Up(120); GenCondition[] genConditionArray1 = new GenCondition[] { (new Conditions.IsSolid()).AreaOr(6, 1) }; if (!WorldUtils.Find(point3, Searches.Chain(up, genConditionArray1), out point1) || point.Y - 5 - point1.Y > 60) { return false; } if (point.Y - point1.Y < 30) { return false; } if (!structures.CanPlace(new Rectangle(point.X - 30, point.Y - 60, 60, 90), 0)) { return false; } Dictionary<ushort, int> nums = new Dictionary<ushort, int>(); Point point4 = new Point(point.X - 25, point.Y - 25); Shapes.Rectangle rectangle = new Shapes.Rectangle(50, 50); ushort[] numArray = new ushort[] { 0, 59, 147, 1 }; WorldUtils.Gen(point4, rectangle, (new Actions.TileScanner(numArray)).Output(nums)); int item = nums[0] + nums[1]; int num = nums[59]; if (nums[147] > num || item > num || num < 50) { return false; } int y = (point.Y - point1.Y - 9) / 5; int num1 = y * 5; int num2 = 0; double num3 = GenBase._random.NextDouble() + 1; double num4 = GenBase._random.NextDouble() + 2; if (GenBase._random.Next(2) == 0) { num4 = -num4; } for (int i = 0; i < y; i++) { double num5 = (double)(i + 1) / 12; int num6 = (int)(Math.Sin(num5 * num3 * 3.14159274101257) * num4); int num7 = (num6 < num2 ? num6 - num2 : 0); Point point5 = new Point(point.X + num2 + num7, point.Y - (i + 1) * 5); Shapes.Rectangle rectangle1 = new Shapes.Rectangle(6 + Math.Abs(num6 - num2), 7); GenAction[] removeWall = new GenAction[] { new Actions.RemoveWall(), new Actions.SetTile(383, false, true), new Actions.SetFrames(false) }; WorldUtils.Gen(point5, rectangle1, Actions.Chain(removeWall)); Point point6 = new Point(point.X + num2 + num7 + 2, point.Y - (i + 1) * 5); Shapes.Rectangle rectangle2 = new Shapes.Rectangle(2 + Math.Abs(num6 - num2), 5); GenAction[] clearTile = new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(78, true) }; WorldUtils.Gen(point6, rectangle2, Actions.Chain(clearTile)); Point point7 = new Point(point.X + num2 + 2, point.Y - i * 5); Shapes.Rectangle rectangle3 = new Shapes.Rectangle(2, 2); GenAction[] genActionArray = new GenAction[] { new Actions.ClearTile(true), new Actions.PlaceWall(78, true) }; WorldUtils.Gen(point7, rectangle3, Actions.Chain(genActionArray)); num2 = num6; } int num8 = 6; if (num4 < 0) { num8 = 0; } List<Point> points = new List<Point>(); for (int j = 0; j < 2; j++) { double num9 = ((double)j + 1) / 3; int num10 = num8 + (int)(Math.Sin((double)y * num9 / 12 * num3 * 3.14159274101257) * num4); double num11 = GenBase._random.NextDouble() * 0.785398185253143 - 0.785398185253143 - 0.200000002980232; if (num8 == 0) { num11 = num11 - 1.57079637050629; } Point point8 = new Point(point.X + num10, point.Y - (int)((double)(y * 5) * num9)); ShapeBranch shapeBranch = (new ShapeBranch(num11, (double)GenBase._random.Next(12, 16))).OutputEndpoints(points); GenAction[] setTile = new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) }; WorldUtils.Gen(point8, shapeBranch, Actions.Chain(setTile)); num8 = 6 - num8; } int num12 = (int)(Math.Sin((double)y / 12 * num3 * 3.14159274101257) * num4); Point point9 = new Point(point.X + 6 + num12, point.Y - num1); ShapeBranch shapeBranch1 = (new ShapeBranch(-0.685398185253143, (double)GenBase._random.Next(16, 22))).OutputEndpoints(points); GenAction[] setTile1 = new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) }; WorldUtils.Gen(point9, shapeBranch1, Actions.Chain(setTile1)); Point point10 = new Point(point.X + num12, point.Y - num1); ShapeBranch shapeBranch2 = (new ShapeBranch(-2.45619455575943, (double)GenBase._random.Next(16, 22))).OutputEndpoints(points); GenAction[] genActionArray1 = new GenAction[] { new Actions.SetTile(383, false, true), new Actions.SetFrames(true) }; WorldUtils.Gen(point10, shapeBranch2, Actions.Chain(genActionArray1)); foreach (Point point11 in points) { Shapes.Circle circle = new Shapes.Circle(4); GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(4, 2, 0.3), null, null, null, null }; ushort[] numArray1 = new ushort[] { 383 }; blotch[1] = new Modifiers.SkipTiles(numArray1); byte[] numArray2 = new byte[] { 78 }; blotch[2] = new Modifiers.SkipWalls(numArray2); blotch[3] = new Actions.SetTile(384, false, true); blotch[4] = new Actions.SetFrames(true); WorldUtils.Gen(point11, circle, Actions.Chain(blotch)); } for (int k = 0; k < 4; k++) { float single = (float)k / 3f * 2f + 0.57075f; WorldUtils.Gen(point, new ShapeRoot(single, (float)GenBase._random.Next(40, 60), 4f, 1f), new Actions.SetTile(383, true, true)); } WorldGen.AddBuriedChest(point.X + 3, point.Y - 1, (GenBase._random.Next(4) == 0 ? 0 : WorldGen.GetNextJungleChestItem()), false, 10); structures.AddStructure(new Rectangle(point.X - 30, point.Y - 30, 60, 60), 0); return true; }
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(new ushort[] { 0, 1 }).Output(dictionary)); int num = dictionary[0] + dictionary[1]; if (num < 1250) { return false; } Point point; bool flag = WorldUtils.Find(origin, Searches.Chain(new Searches.Up(1000), new GenCondition[] { new Conditions.IsSolid().AreaOr(1, 50).Not() }), out point); Point point2; bool flag2 = WorldUtils.Find(origin, Searches.Chain(new Searches.Up(origin.Y - point.Y), new GenCondition[] { new Conditions.IsTile(new ushort[] { 53 }) }), out point2); if (flag2) { return false; } if (!flag) { return false; } point.Y += 50; ShapeData shapeData = new ShapeData(); ShapeData shapeData2 = new ShapeData(); Point point3 = new Point(origin.X, origin.Y + 20); Point point4 = new Point(origin.X, origin.Y + 30); float num2 = 0.8f + GenBase._random.NextFloat() * 0.5f; if (!structures.CanPlace(new Rectangle(point3.X - (int)(20f * num2), point3.Y - 20, (int)(40f * num2), 40), 0)) { return false; } if (!structures.CanPlace(new Rectangle(origin.X, point.Y + 10, 1, origin.Y - point.Y - 9), 2)) { return false; } WorldUtils.Gen(point3, new Shapes.Slime(20, num2, 1f), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.4), new Actions.ClearTile(true).Output(shapeData) })); WorldUtils.Gen(point4, new Shapes.Mound(14, 14), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 1, 0.8), new Actions.SetTile(0, false, true), new Actions.SetFrames(true).Output(shapeData2) })); shapeData.Subtract(shapeData2, point3, point4); WorldUtils.Gen(point3, new ModShapes.InnerOutline(shapeData, true), Actions.Chain(new GenAction[] { new Actions.SetTile(2, false, true), new Actions.SetFrames(true) })); WorldUtils.Gen(point3, new ModShapes.All(shapeData), Actions.Chain(new GenAction[] { new Modifiers.RectangleMask(-40, 40, 0, 40), new Modifiers.IsEmpty(), new Actions.SetLiquid(0, 255) })); WorldUtils.Gen(point3, new ModShapes.All(shapeData), Actions.Chain(new GenAction[] { new Actions.PlaceWall(68, true), new Modifiers.OnlyTiles(new ushort[] { 2 }), new Modifiers.Offset(0, 1), new ActionVines(3, 5, 52) })); ShapeData data = new ShapeData(); WorldUtils.Gen(new Point(origin.X, point.Y + 10), new Shapes.Rectangle(1, origin.Y - point.Y - 9), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.2), new Actions.ClearTile(false).Output(data), new Modifiers.Expand(1), new Modifiers.OnlyTiles(new ushort[] { 53 }), new Actions.SetTile(397, false, true).Output(data) })); WorldUtils.Gen(new Point(origin.X, point.Y + 10), new ModShapes.All(data), new Actions.SetFrames(true)); if (GenBase._random.Next(3) == 0) { WorldGen.PlaceTile(point4.X, point4.Y - 15, 187, true, false, -1, 17); } else { WorldGen.PlaceTile(point4.X, point4.Y - 15, 186, true, false, -1, 15); } WorldUtils.Gen(point4, new ModShapes.All(shapeData2), Actions.Chain(new GenAction[] { new Modifiers.Offset(0, -1), new Modifiers.OnlyTiles(new ushort[] { 2 }), new Modifiers.Offset(0, -1), new ActionGrass() })); structures.AddStructure(new Rectangle(point3.X - (int)(20f * num2), point3.Y - 20, (int)(40f * num2), 40), 4); return true; }
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; }
public override bool Place(Point origin, StructureMap structures) { Ref<int> count1 = new Ref<int>(0); Ref<int> count2 = new Ref<int>(0); Ref<int> count3 = new Ref<int>(0); Ref<int> count4 = new Ref<int>(0); WorldUtils.Gen(origin, new Shapes.Circle(15), Actions.Chain(new Actions.Scanner(count3), new Modifiers.IsSolid(), new Actions.Scanner(count1), new Modifiers.OnlyTiles(new ushort[2] { 60, 59 }), new Actions.Scanner(count2), new Modifiers.OnlyTiles(new ushort[1] { 60 }), new Actions.Scanner(count4))); if (((((float)count2.Value) / ((float)count1.Value)) < 0.75) || count4.Value < 2 || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 0)) return false; int num1 = origin.X; int num2 = origin.Y; int num3 = 150; int index1 = num1 - num3; while (index1 < num1 + num3) { if (index1 > 0 && index1 <= Main.maxTilesX - 1) { int index2 = num2 - num3; while (index2 < num2 + num3) { if (index2 > 0 && index2 <= Main.maxTilesY - 1 && (Main.tile[index1, index2].active() && Main.tile[index1, index2].type == 226 || (Main.tile[index1, index2].wall == 87 || Main.tile[index1, index2].wall == 3) || Main.tile[index1, index2].wall == 83)) return false; index2 += 10; } } index1 += 10; } int num4 = origin.X; int num5 = origin.Y; int index3 = 0; int[] numArray1 = new int[10]; int[] numArray2 = new int[10]; Vector2 vector2_1 = new Vector2((float)num4, (float)num5); Vector2 vector2_2 = vector2_1; int num6 = WorldGen.genRand.Next(2, 5); for (int index2 = 0; index2 < num6; ++index2) { int num7 = WorldGen.genRand.Next(2, 5); for (int index4 = 0; index4 < num7; ++index4) vector2_2 = WorldGen.Hive((int)vector2_1.X, (int)vector2_1.Y); vector2_1 = vector2_2; numArray1[index3] = (int)vector2_1.X; numArray2[index3] = (int)vector2_1.Y; ++index3; } for (int index2 = 0; index2 < index3; ++index2) { int index4 = numArray1[index2]; int index5 = numArray2[index2]; bool flag = false; int num7 = 1; if (WorldGen.genRand.Next(2) == 0) num7 = -1; while (index4 > 10 && index4 < Main.maxTilesX - 10 && (index5 > 10 && index5 < Main.maxTilesY - 10) && (!Main.tile[index4, index5].active() || !Main.tile[index4, index5 + 1].active() || (!Main.tile[index4 + 1, index5].active() || !Main.tile[index4 + 1, index5 + 1].active()))) { index4 += num7; if (Math.Abs(index4 - numArray1[index2]) > 50) { flag = true; break; } } if (!flag) { int i = index4 + num7; for (int index6 = i - 1; index6 <= i + 2; ++index6) { for (int index7 = index5 - 1; index7 <= index5 + 2; ++index7) { if (index6 < 10 || index6 > Main.maxTilesX - 10) flag = true; else if (Main.tile[index6, index7].active() && (int)Main.tile[index6, index7].type != 225) { flag = true; break; } } } if (!flag) { for (int index6 = i - 1; index6 <= i + 2; ++index6) { for (int index7 = index5 - 1; index7 <= index5 + 2; ++index7) { if (index6 >= i && index6 <= i + 1 && (index7 >= index5 && index7 <= index5 + 1)) { Main.tile[index6, index7].active(false); Main.tile[index6, index7].liquid = byte.MaxValue; Main.tile[index6, index7].honey(true); } else { Main.tile[index6, index7].active(true); Main.tile[index6, index7].type = (ushort)225; } } } int num8 = num7 * -1; int j = index5 + 1; int num9 = 0; while ((num9 < 4 || WorldGen.SolidTile(i, j)) && (i > 10 && i < Main.maxTilesX - 10)) { ++num9; i += num8; if (WorldGen.SolidTile(i, j)) { WorldGen.PoundTile(i, j); if (!Main.tile[i, j + 1].active()) { Main.tile[i, j + 1].active(true); Main.tile[i, j + 1].type = (ushort)225; } } } } } } WorldGen.larvaX[WorldGen.numLarva] = Utils.Clamp<int>((int)vector2_1.X, 5, Main.maxTilesX - 5); WorldGen.larvaY[WorldGen.numLarva] = Utils.Clamp<int>((int)vector2_1.Y, 5, Main.maxTilesY - 5); ++WorldGen.numLarva; int num10 = (int)vector2_1.X; int num11 = (int)vector2_1.Y; for (int index2 = num10 - 1; index2 <= num10 + 1 && (index2 > 0 && index2 < Main.maxTilesX); ++index2) { for (int index4 = num11 - 2; index4 <= num11 + 1 && (index4 > 0 && index4 < Main.maxTilesY); ++index4) { if (index4 != num11 + 1) Main.tile[index2, index4].active(false); else { Main.tile[index2, index4].active(true); Main.tile[index2, index4].type = (ushort)225; Main.tile[index2, index4].slope((byte)0); Main.tile[index2, index4].halfBrick(false); } } } structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5); return 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; }
public override bool Place(Point origin, StructureMap structures) { if (WorldGen.SolidTile(origin.X, origin.Y)) { return false; } ushort type = Utils.SelectRandom<ushort>(GenBase._random, new ushort[] { (ushort)((WorldGen.goldBar == 19) ? 8 : 169), (ushort)((WorldGen.silverBar == 21) ? 9 : 168), (ushort)((WorldGen.ironBar == 22) ? 6 : 167), (ushort)((WorldGen.copperBar == 20) ? 7 : 166) }); double num = GenBase._random.NextDouble() * 2.0 - 1.0; GenSearch genSearch; if (num > 0.0) { genSearch = new Searches.Right(40); } else { genSearch = new Searches.Left(40); } if (!WorldUtils.Find(origin, Searches.Chain(genSearch, new GenCondition[] { new Conditions.IsSolid() }), out origin)) { return false; } if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(80), new GenCondition[] { new Conditions.IsSolid() }), out origin)) { return false; } ShapeData shapeData = new ShapeData(); Ref<int> @ref = new Ref<int>(0); Ref<int> ref2 = new Ref<int>(0); WorldUtils.Gen(origin, new ShapeRunner(10f, 20, new Vector2((float)num, 1f)).Output(shapeData), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.3), new Actions.Scanner(@ref), new Modifiers.IsSolid(), new Actions.Scanner(ref2) })); if (ref2.Value < @ref.Value / 2) { return false; } Rectangle area = new Rectangle(origin.X - 15, origin.Y - 10, 30, 20); if (!structures.CanPlace(area, 0)) { return false; } WorldUtils.Gen(origin, new ModShapes.All(shapeData), new Actions.SetTile(type, true, true)); WorldUtils.Gen(new Point(origin.X - (int)(num * -5.0), origin.Y - 5), new Shapes.Circle(5), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.3), new Actions.ClearTile(true) })); bool flag = true; Point start; flag &= WorldUtils.Find(new Point(origin.X - ((num > 0.0) ? 3 : -3), origin.Y - 3), Searches.Chain(new Searches.Down(10), new GenCondition[] { new Conditions.IsSolid() }), out start); Point end; if (!(flag & WorldUtils.Find(new Point(origin.X - ((num > 0.0) ? -3 : 3), origin.Y - 3), Searches.Chain(new Searches.Down(10), new GenCondition[] { new Conditions.IsSolid() }), out end))) { return false; } start.Y--; end.Y--; Tile tile = GenBase._tiles[start.X, start.Y + 1]; tile.slope(0); tile.halfBrick(false); for (int i = -1; i <= 1; i++) { WorldUtils.ClearTile(end.X + i, end.Y, false); Tile tile2 = GenBase._tiles[end.X + i, end.Y + 1]; if (!WorldGen.SolidOrSlopedTile(tile2)) { tile2.ResetToType(1); tile2.active(true); } tile2.slope(0); tile2.halfBrick(false); WorldUtils.TileFrame(end.X + i, end.Y + 1, true); } WorldGen.PlaceTile(start.X, start.Y, 141, false, false, -1, 0); WorldGen.PlaceTile(end.X, end.Y, 411, true, true, -1, 0); WorldUtils.WireLine(start, end); structures.AddStructure(area, 5); return true; }