public override bool Place(Point origin, StructureMap structures) { if (GenBase._tiles[origin.X, origin.Y].active()) { return(false); } origin.X -= this._sourceMagmaMap.GetLength(0) / 2; origin.Y -= this._sourceMagmaMap.GetLength(1) / 2; this.BuildMagmaMap(origin); Microsoft.Xna.Framework.Rectangle effectedMapArea; this.SimulatePressure(out effectedMapArea); this.PlaceGranite(origin, effectedMapArea); this.CleanupTiles(origin, effectedMapArea); this.PlaceDecorations(origin, effectedMapArea); structures.AddStructure(effectedMapArea, 8); 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); }
private void PlaceSingle(DunesBiome.DunesDescription description, StructureMap structures) { int num1 = GenBase._random.Next(3) + 8; for (int index = 0; index < num1 - 1; ++index) { int num2 = (int)(2.0 / (double)num1 * (double)description.Area.Width); int num3 = (int)((double)index / (double)num1 * (double)description.Area.Width + (double)description.Area.Left) + num2 * 2 / 5 + GenBase._random.Next(-5, 6); float num4 = (float)(1.0 - (double)Math.Abs((float)index / (float)(num1 - 2) - 0.5f) * 2.0); DunesBiome.PlaceHill(num3 - num2 / 2, num3 + num2 / 2, (float)((double)num4 * 0.300000011920929 + 0.200000002980232) * this._heightScale, description); } int num5 = GenBase._random.Next(2) + 1; for (int index = 0; index < num5; ++index) { int num2 = description.Area.Width / 2; int num3 = description.Area.Center.X + GenBase._random.Next(-10, 11); DunesBiome.PlaceHill(num3 - num2 / 2, num3 + num2 / 2, 0.8f * this._heightScale, description); } structures.AddStructure(description.Area, 20); }
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[5] { (ushort)0, (ushort)59, (ushort)147, (ushort)1, (ushort)225 }).Output(resultsOutput)); int num1 = resultsOutput[(ushort)0] + resultsOutput[(ushort)1]; int num2 = resultsOutput[(ushort)59]; int num3 = resultsOutput[(ushort)147]; if (resultsOutput[(ushort)225] > 0 || 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), (GenShape) new Shapes.Circle(radius), Actions.Chain((GenAction) new Modifiers.Blotches(4, 0.3), (GenAction) new Modifiers.OnlyTiles(new ushort[5] { (ushort)147, (ushort)161, (ushort)224, (ushort)0, (ushort)1 }), (GenAction) new Actions.SetTile((ushort)162, true, true))); WorldUtils.Gen(new Point(origin.X + num5, origin.Y + num4), (GenShape) new Shapes.Circle(radius), Actions.Chain((GenAction) new Modifiers.Blotches(4, 0.3), (GenAction) new Modifiers.HasLiquid(-1, -1), (GenAction) new Actions.SetTile((ushort)162, true, true), (GenAction) new Actions.SetLiquid(0, (byte)0))); num4 += radius - 2; } structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(origin.X - 25, origin.Y - 25, 50, 50), 8); return(true); }
public override bool Place(Point origin, StructureMap structures) { DesertDescription desertDescription = DesertDescription.CreateFromPlacement(origin); if (!desertDescription.IsValid) { return(false); } ExportDescriptionToEngine(desertDescription); SandMound.Place(desertDescription); desertDescription.UpdateSurfaceMap(); if (GenBase._random.NextFloat() <= ChanceOfEntrance) { switch (GenBase._random.Next(4)) { case 0: ChambersEntrance.Place(desertDescription); break; case 1: AnthillEntrance.Place(desertDescription); break; case 2: LarvaHoleEntrance.Place(desertDescription); break; case 3: PitEntrance.Place(desertDescription); break; } } DesertHive.Place(desertDescription); CleanupArea(desertDescription.Hive); Rectangle area = new Rectangle(desertDescription.CombinedArea.X, 50, desertDescription.CombinedArea.Width, desertDescription.CombinedArea.Bottom - 20); structures.AddStructure(area, 10); return(true); }
public override bool Place(Point origin, StructureMap structures) { DesertDescription fromPlacement = DesertDescription.CreateFromPlacement(origin); if (!fromPlacement.IsValid) { return(false); } DesertBiome.ExportDescriptionToEngine(fromPlacement); SandMound.Place(fromPlacement); fromPlacement.UpdateSurfaceMap(); if ((double)GenBase._random.NextFloat() <= (double)this.ChanceOfEntrance) { switch (GenBase._random.Next(4)) { case 0: ChambersEntrance.Place(fromPlacement); break; case 1: AnthillEntrance.Place(fromPlacement); break; case 2: LarvaHoleEntrance.Place(fromPlacement); break; case 3: PitEntrance.Place(fromPlacement); break; } } DesertHive.Place(fromPlacement); DesertBiome.CleanupArea(fromPlacement.Hive); Microsoft.Xna.Framework.Rectangle area = new Microsoft.Xna.Framework.Rectangle(fromPlacement.CombinedArea.X, 50, fromPlacement.CombinedArea.Width, fromPlacement.CombinedArea.Bottom - 20); structures.AddStructure(area, 10); return(true); }
public override bool Place(Point origin, StructureMap structures) { if (_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), (GenCondition) new Conditions.IsSolid()), out result)) { return(false); } result.Y += 2; var count = new Ref <int>(0); WorldUtils.Gen(result, 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, new Shapes.Circle(8), Actions.Chain((GenAction) new Modifiers.RadialDither(0.0f, 10f), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.SetTile(229, true, true))); var data = new ShapeData(); WorldUtils.Gen(result, 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), new ModShapes.InnerOutline(data, true), Actions.Chain((GenAction) new Modifiers.IsEmpty(), (GenAction) new Modifiers.RectangleMask(-6, 6, 1, 3), (GenAction) new Actions.SetTile(59, true, true))); structures.AddStructure(new Rectangle(result.X - 8, result.Y - 8, 16, 16), 0); return(true); }
private void PlaceSingle(DunesDescription description, StructureMap structures) { int num = GenBase._random.Next(3) + 8; for (int i = 0; i < num - 1; i++) { int num2 = (int)(2f / (float)num * (float)description.Area.Width); int num3 = (int)((float)i / (float)num * (float)description.Area.Width + (float)description.Area.Left) + num2 * 2 / 5; num3 += GenBase._random.Next(-5, 6); float num4 = (float)i / (float)(num - 2); float num5 = 1f - Math.Abs(num4 - 0.5f) * 2f; PlaceHill(num3 - num2 / 2, num3 + num2 / 2, (num5 * 0.3f + 0.2f) * _heightScale, description); } int num6 = GenBase._random.Next(2) + 1; for (int j = 0; j < num6; j++) { int num7 = description.Area.Width / 2; int x = description.Area.Center.X; x += GenBase._random.Next(-10, 11); PlaceHill(x - num7 / 2, x + num7 / 2, 0.8f * _heightScale, description); } structures.AddStructure(description.Area, 20); }
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 Actions.Scanner(count), new Modifiers.IsSolid(), new Actions.Scanner(@ref), new Modifiers.OnlyTiles(60, 59), new Actions.Scanner(ref2), new Modifiers.OnlyTiles(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))) { 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) { continue; } 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(x2, 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) { continue; } 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) { continue; } 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 = byte.MaxValue; 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)vector.X, 5, Main.maxTilesX - 5); WorldGen.larvaY[WorldGen.numLarva] = Utils.Clamp((int)vector.Y, 5, Main.maxTilesY - 5); WorldGen.numLarva++; int num12 = (int)vector.X; int num13 = (int)vector.Y; for (int num14 = num12 - 1; num14 <= num12 + 1 && num14 > 0 && num14 < Main.maxTilesX; num14++) { for (int num15 = num13 - 2; num15 <= num13 + 1 && num15 > 0 && num15 < Main.maxTilesY; num15++) { if (num15 != num13 + 1) { Main.tile[num14, num15].active(false); continue; } Main.tile[num14, num15].active(true); Main.tile[num14, num15].type = 225; Main.tile[num14, num15].slope(0); Main.tile[num14, num15].halfBrick(false); } } structures.AddStructure(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5); return(true); }
public override bool Place(Point origin, StructureMap structures) { if (WorldGen.SolidTile(origin.X, origin.Y) && _tiles[origin.X, origin.Y].wall == 3) { return(false); } if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(100), (GenCondition) 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((ushort)25).AreaAnd(8, 1)), out result)) { return(false); } var data1 = new ShapeData(); var shapeData1 = new ShapeData(); var shapeData2 = new ShapeData(); for (var index = 0; index < 6; ++index) { WorldUtils.Gen(origin, new Shapes.Circle(_random.Next(10, 12) + index), Actions.Chain((GenAction) new Modifiers.Offset(0, 5 * index + 5), new Modifiers.Blotches(3, 0.3).Output(data1))); } for (var index = 0; index < 6; ++index) { WorldUtils.Gen(origin, new Shapes.Circle(_random.Next(5, 7) + index), Actions.Chain((GenAction) new Modifiers.Offset(0, 2 * index + 18), new Modifiers.Blotches(3, 0.3).Output(shapeData1))); } for (var index = 0; index < 6; ++index) { WorldUtils.Gen(origin, new Shapes.Circle(_random.Next(4, 6) + index / 2), Actions.Chain((GenAction) new Modifiers.Offset(0, (int)(7.5 * index) - 10), new Modifiers.Blotches(3, 0.3).Output(shapeData2))); } var data2 = new ShapeData(shapeData1); shapeData1.Subtract(shapeData2, origin, origin); data2.Subtract(shapeData1, origin, origin); var bounds = ShapeData.GetBounds(origin, data1, shapeData2); if (!structures.CanPlace(bounds, ValidTiles, 2)) { return(false); } WorldUtils.Gen(origin, new ModShapes.All(data1), Actions.Chain((GenAction) new Actions.SetTile(25, true, true), (GenAction) 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( (GenAction) new Modifiers.IsTouchingAir(true), (GenAction) new Modifiers.NotTouching(false, (ushort)25), (GenAction) 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) { var count1 = new Ref <int>(0); var count2 = new Ref <int>(0); var count3 = new Ref <int>(0); var count4 = new Ref <int>(0); WorldUtils.Gen(origin, new Shapes.Circle(15), Actions.Chain( (GenAction) new Actions.Scanner(count3), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count1), (GenAction) new Modifiers.OnlyTiles((ushort)60, (ushort)59), (GenAction) new Actions.Scanner(count2), (GenAction) new Modifiers.OnlyTiles((ushort)60), (GenAction) new Actions.Scanner(count4))); if (count2.Value / (double)count1.Value < 0.75 || count4.Value < 2 || !structures.CanPlace(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 0)) { return(false); } var x1 = origin.X; var y1 = origin.Y; var num1 = 150; var index1 = x1 - num1; while (index1 < x1 + num1) { if (index1 > 0 && index1 <= Main.maxTilesX - 1) { var index2 = y1 - num1; while (index2 < y1 + num1) { 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; } var x2 = origin.X; var y2 = origin.Y; var index3 = 0; var numArray1 = new int[10]; var numArray2 = new int[10]; var vector2_1 = new Vector2(x2, y2); var vector2_2 = vector2_1; var num2 = WorldGen.genRand.Next(2, 5); for (var index2 = 0; index2 < num2; ++index2) { var num3 = WorldGen.genRand.Next(2, 5); for (var index4 = 0; index4 < num3; ++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 (var index2 = 0; index2 < index3; ++index2) { var index4 = numArray1[index2]; var index5 = numArray2[index2]; var flag = false; var num3 = 1; if (WorldGen.genRand.Next(2) == 0) { num3 = -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 += num3; if (Math.Abs(index4 - numArray1[index2]) > 50) { flag = true; break; } } if (!flag) { var i = index4 + num3; for (var index6 = i - 1; index6 <= i + 2; ++index6) { for (var index7 = index5 - 1; index7 <= index5 + 2; ++index7) { if (index6 < 10 || index6 > Main.maxTilesX - 10) { flag = true; } else if (Main.tile[index6, index7].active() && Main.tile[index6, index7].type != 225) { flag = true; break; } } } if (!flag) { for (var index6 = i - 1; index6 <= i + 2; ++index6) { for (var 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 = 225; } } } var num4 = num3 * -1; var j = index5 + 1; var num5 = 0; while ((num5 < 4 || WorldGen.SolidTile(i, j)) && i > 10 && i < Main.maxTilesX - 10) { ++num5; i += num4; 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 = 225; } } } } } } WorldGen.larvaX[WorldGen.numLarva] = Utils.Clamp((int)vector2_1.X, 5, Main.maxTilesX - 5); WorldGen.larvaY[WorldGen.numLarva] = Utils.Clamp((int)vector2_1.Y, 5, Main.maxTilesY - 5); ++WorldGen.numLarva; var x3 = (int)vector2_1.X; var y3 = (int)vector2_1.Y; for (var index2 = x3 - 1; index2 <= x3 + 1 && index2 > 0 && index2 < Main.maxTilesX; ++index2) { for (var index4 = y3 - 2; index4 <= y3 + 1 && index4 > 0 && index4 < Main.maxTilesY; ++index4) { if (index4 != y3 + 1) { Main.tile[index2, index4].active(false); } else { Main.tile[index2, index4].active(true); Main.tile[index2, index4].type = 225; Main.tile[index2, index4].slope(0); Main.tile[index2, index4].halfBrick(false); } } } structures.AddStructure(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5); 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 result1; if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(200), (GenCondition) new Conditions.IsSolid()), out result1) || Point.op_Equality(result1, origin)) { return(false); } Rectangle room1 = this.GetRoom(result1); // ISSUE: explicit reference operation Rectangle room2 = this.GetRoom(new Point((int)((Rectangle)@room1).get_Center().X, room1.Y + 1)); // ISSUE: explicit reference operation Rectangle room3 = this.GetRoom(new Point((int)((Rectangle)@room1).get_Center().X, room1.Y + room1.Height + 10)); room3.Y = (__Null)(room1.Y + room1.Height - 1); float num1 = this.RoomSolidPrecentage(room2); float num2 = this.RoomSolidPrecentage(room3); // ISSUE: explicit reference operation // ISSUE: variable of a reference type Rectangle& local1 = @room1; // ISSUE: explicit reference operation int num3 = (^ local1).Y + 3; // ISSUE: explicit reference operation (^ local1).Y = (__Null)num3; // ISSUE: explicit reference operation // ISSUE: variable of a reference type Rectangle& local2 = @room2; // ISSUE: explicit reference operation int num4 = (^ local2).Y + 3; // ISSUE: explicit reference operation (^ local2).Y = (__Null)num4; // ISSUE: explicit reference operation // ISSUE: variable of a reference type Rectangle& local3 = @room3; // ISSUE: explicit reference operation int num5 = (^ local3).Y + 3; // ISSUE: explicit reference operation (^ local3).Y = (__Null)num5; List <Rectangle> rectangleList1 = new List <Rectangle>(); if ((double)GenBase._random.NextFloat() > (double)num1 + 0.200000002980232) { rectangleList1.Add(room2); } else { room2 = room1; } rectangleList1.Add(room1); if ((double)GenBase._random.NextFloat() > (double)num2 + 0.200000002980232) { rectangleList1.Add(room3); } else { room3 = room1; } using (List <Rectangle> .Enumerator enumerator = rectangleList1.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; if (current.Y + current.Height > Main.maxTilesY - 220) { return(false); } } } Dictionary <ushort, int> resultsOutput = new Dictionary <ushort, int>(); using (List <Rectangle> .Enumerator enumerator = rectangleList1.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; WorldUtils.Gen(new Point(current.X - 10, current.Y - 10), (GenShape) new Shapes.Rectangle(current.Width + 20, current.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 <CaveHouseBiome.BuildData, int> > tupleList1 = new List <Tuple <CaveHouseBiome.BuildData, int> >(); tupleList1.Add((Tuple <CaveHouseBiome.BuildData, int>)Tuple.Create <CaveHouseBiome.BuildData, int>((M0)CaveHouseBiome.BuildData.Default, (M1)(resultsOutput[(ushort)0] + resultsOutput[(ushort)1]))); tupleList1.Add((Tuple <CaveHouseBiome.BuildData, int>)Tuple.Create <CaveHouseBiome.BuildData, int>((M0)CaveHouseBiome.BuildData.Jungle, (M1)(resultsOutput[(ushort)59] + resultsOutput[(ushort)60] * 10))); tupleList1.Add((Tuple <CaveHouseBiome.BuildData, int>)Tuple.Create <CaveHouseBiome.BuildData, int>((M0)CaveHouseBiome.BuildData.Mushroom, (M1)(resultsOutput[(ushort)59] + resultsOutput[(ushort)70] * 10))); tupleList1.Add((Tuple <CaveHouseBiome.BuildData, int>)Tuple.Create <CaveHouseBiome.BuildData, int>((M0)CaveHouseBiome.BuildData.Snow, (M1)(resultsOutput[(ushort)147] + resultsOutput[(ushort)161]))); tupleList1.Add((Tuple <CaveHouseBiome.BuildData, int>)Tuple.Create <CaveHouseBiome.BuildData, int>((M0)CaveHouseBiome.BuildData.Desert, (M1)(resultsOutput[(ushort)397] + resultsOutput[(ushort)396] + resultsOutput[(ushort)53]))); tupleList1.Add((Tuple <CaveHouseBiome.BuildData, int>)Tuple.Create <CaveHouseBiome.BuildData, int>((M0)CaveHouseBiome.BuildData.Granite, (M1)resultsOutput[(ushort)368])); tupleList1.Add((Tuple <CaveHouseBiome.BuildData, int>)Tuple.Create <CaveHouseBiome.BuildData, int>((M0)CaveHouseBiome.BuildData.Marble, (M1)resultsOutput[(ushort)367])); tupleList1.Sort(new Comparison <Tuple <CaveHouseBiome.BuildData, int> >(this.SortBiomeResults)); CaveHouseBiome.BuildData buildData = tupleList1[0].get_Item1(); using (List <Rectangle> .Enumerator enumerator = rectangleList1.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; if (buildData != CaveHouseBiome.BuildData.Granite) { Point result2; if (WorldUtils.Find(new Point(current.X - 2, current.Y - 2), Searches.Chain(new Searches.Rectangle(current.Width + 4, current.Height + 4).RequireAll(false), (GenCondition) new Conditions.HasLava()), out result2)) { return(false); } } if (!structures.CanPlace(current, CaveHouseBiome._blacklistedTiles, 5)) { return(false); } } } int val1_1 = (int)room1.X; int val1_2 = room1.X + room1.Width - 1; List <Rectangle> rectangleList2 = new List <Rectangle>(); using (List <Rectangle> .Enumerator enumerator = rectangleList1.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; val1_1 = Math.Min(val1_1, (int)current.X); val1_2 = Math.Max(val1_2, current.X + current.Width - 1); } } int num6 = 6; while (num6 > 4 && (val1_2 - val1_1) % num6 != 0) { --num6; } int num7 = val1_1; while (num7 <= val1_2) { for (int index1 = 0; index1 < rectangleList1.Count; ++index1) { Rectangle rectangle = rectangleList1[index1]; if (num7 >= rectangle.X && num7 < rectangle.X + rectangle.Width) { int num8 = (int)(rectangle.Y + rectangle.Height); int num9 = 50; for (int index2 = index1 + 1; index2 < rectangleList1.Count; ++index2) { if (num7 >= rectangleList1[index2].X && num7 < rectangleList1[index2].X + rectangleList1[index2].Width) { num9 = Math.Min(num9, rectangleList1[index2].Y - num8); } } if (num9 > 0) { Point result2; bool flag = WorldUtils.Find(new Point(num7, num8), Searches.Chain((GenSearch) new Searches.Down(num9), (GenCondition) new Conditions.IsSolid()), out result2); if (num9 < 50) { flag = true; result2 = new Point(num7, num8 + num9); } if (flag) { rectangleList2.Add(new Rectangle(num7, num8, 1, result2.Y - num8)); } } } } num7 += num6; } List <Point> pointList1 = new List <Point>(); using (List <Rectangle> .Enumerator enumerator = rectangleList1.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; int exitY; if (this.FindSideExit(new Rectangle((int)(current.X + current.Width), current.Y + 1, 1, current.Height - 2), false, out exitY)) { pointList1.Add(new Point(current.X + current.Width - 1, exitY)); } if (this.FindSideExit(new Rectangle((int)current.X, current.Y + 1, 1, current.Height - 2), true, out exitY)) { pointList1.Add(new Point((int)current.X, exitY)); } } } List <Tuple <Point, Point> > tupleList2 = new List <Tuple <Point, Point> >(); for (int index = 1; index < rectangleList1.Count; ++index) { Rectangle rectangle1 = rectangleList1[index]; Rectangle rectangle2 = rectangleList1[index - 1]; if ((int)(rectangle2.X - rectangle1.X) > (int)(rectangle1.X + rectangle1.Width - (rectangle2.X + rectangle2.Width))) { tupleList2.Add(new Tuple <Point, Point>(new Point(rectangle1.X + rectangle1.Width - 1, rectangle1.Y + 1), new Point(rectangle1.X + rectangle1.Width - rectangle1.Height + 1, rectangle1.Y + rectangle1.Height - 1))); } else { tupleList2.Add(new Tuple <Point, Point>(new Point((int)rectangle1.X, rectangle1.Y + 1), new Point(rectangle1.X + rectangle1.Height - 1, rectangle1.Y + rectangle1.Height - 1))); } } List <Point> pointList2 = new List <Point>(); int exitX; if (this.FindVerticalExit(new Rectangle(room2.X + 2, (int)room2.Y, room2.Width - 4, 1), true, out exitX)) { pointList2.Add(new Point(exitX, (int)room2.Y)); } if (this.FindVerticalExit(new Rectangle(room3.X + 2, room3.Y + room3.Height - 1, room3.Width - 4, 1), false, out exitX)) { pointList2.Add(new Point(exitX, room3.Y + room3.Height - 1)); } using (List <Rectangle> .Enumerator enumerator = rectangleList1.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; WorldUtils.Gen(new Point((int)current.X, (int)current.Y), (GenShape) new Shapes.Rectangle((int)current.Width, (int)current.Height), Actions.Chain((GenAction) new Actions.SetTile(buildData.Tile, false, true), (GenAction) new Actions.SetFrames(true))); WorldUtils.Gen(new Point(current.X + 1, current.Y + 1), (GenShape) new Shapes.Rectangle(current.Width - 2, current.Height - 2), Actions.Chain((GenAction) new Actions.ClearTile(true), (GenAction) new Actions.PlaceWall(buildData.Wall, true))); structures.AddStructure(current, 8); } } using (List <Tuple <Point, Point> > .Enumerator enumerator = tupleList2.GetEnumerator()) { while (enumerator.MoveNext()) { Tuple <Point, Point> current = enumerator.Current; Point origin1 = current.get_Item1(); Point point = current.get_Item2(); int num8 = point.X > origin1.X ? 1 : -1; ShapeData data = new ShapeData(); for (int y = 0; y < point.Y - origin1.Y; ++y) { data.Add(num8 * (y + 1), y); } WorldUtils.Gen(origin1, (GenShape) new ModShapes.All(data), Actions.Chain((GenAction) new Actions.PlaceTile((ushort)19, buildData.PlatformStyle), (GenAction) new Actions.SetSlope(num8 == 1 ? 1 : 2), (GenAction) new Actions.SetFrames(true))); WorldUtils.Gen(new Point(origin1.X + (num8 == 1 ? 1 : -4), origin1.Y - 1), (GenShape) new Shapes.Rectangle(4, 1), Actions.Chain((GenAction) new Actions.Clear(), (GenAction) new Actions.PlaceWall(buildData.Wall, true), (GenAction) new Actions.PlaceTile((ushort)19, buildData.PlatformStyle), (GenAction) new Actions.SetFrames(true))); } } using (List <Point> .Enumerator enumerator = pointList1.GetEnumerator()) { while (enumerator.MoveNext()) { Point current = enumerator.Current; WorldUtils.Gen(current, (GenShape) new Shapes.Rectangle(1, 3), (GenAction) new Actions.ClearTile(true)); WorldGen.PlaceTile((int)current.X, (int)current.Y, 10, true, true, -1, buildData.DoorStyle); } } using (List <Point> .Enumerator enumerator = pointList2.GetEnumerator()) { while (enumerator.MoveNext()) { WorldUtils.Gen(enumerator.Current, (GenShape) new Shapes.Rectangle(3, 1), Actions.Chain((GenAction) new Actions.ClearMetadata(), (GenAction) new Actions.PlaceTile((ushort)19, buildData.PlatformStyle), (GenAction) new Actions.SetFrames(true))); } } using (List <Rectangle> .Enumerator enumerator = rectangleList2.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; if (current.Height > 1 && (int)GenBase._tiles[(int)current.X, current.Y - 1].type != 19) { WorldUtils.Gen(new Point((int)current.X, (int)current.Y), (GenShape) new Shapes.Rectangle((int)current.Width, (int)current.Height), Actions.Chain((GenAction) new Actions.SetTile((ushort)124, false, true), (GenAction) new Actions.SetFrames(true))); Tile tile = GenBase._tiles[(int)current.X, (int)(current.Y + current.Height)]; tile.slope((byte)0); tile.halfBrick(false); } } } Point[] pointArray = new Point[7] { new Point(14, buildData.TableStyle), new Point(16, 0), new Point(18, buildData.WorkbenchStyle), new Point(86, 0), new Point(87, buildData.PianoStyle), new Point(94, 0), new Point(101, buildData.BookcaseStyle) }; using (List <Rectangle> .Enumerator enumerator = rectangleList1.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; int num8 = current.Width / 8; int num9 = current.Width / (num8 + 1); int num10 = GenBase._random.Next(2); for (int index1 = 0; index1 < num8; ++index1) { int num11 = (index1 + 1) * num9 + current.X; switch (index1 + num10 % 2) { case 0: int num12 = current.Y + Math.Min(current.Height / 2, current.Height - 5); Vector2 vector2 = WorldGen.randHousePicture(); int x = (int)vector2.X; int y = (int)vector2.Y; if (!WorldGen.nearPicture(num11, num12)) { WorldGen.PlaceTile(num11, num12, x, true, false, -1, y); break; } break; case 1: int j = current.Y + 1; WorldGen.PlaceTile(num11, j, 34, true, false, -1, GenBase._random.Next(6)); for (int index2 = -1; index2 < 2; ++index2) { for (int index3 = 0; index3 < 3; ++index3) { GenBase._tiles[index2 + num11, index3 + j].frameX += (short)54; } } break; } } int num13 = current.Width / 8 + 3; WorldGen.SetupStatueList(); for (; num13 > 0; --num13) { int num11 = GenBase._random.Next(current.Width - 3) + 1 + current.X; int num12 = current.Y + current.Height - 2; switch (GenBase._random.Next(4)) { case 0: WorldGen.PlaceSmallPile(num11, num12, GenBase._random.Next(31, 34), 1, (ushort)185); break; case 1: WorldGen.PlaceTile(num11, num12, 186, true, false, -1, GenBase._random.Next(22, 26)); break; case 2: int index = GenBase._random.Next(2, WorldGen.statueList.Length); WorldGen.PlaceTile(num11, num12, (int)WorldGen.statueList[index].X, true, false, -1, (int)WorldGen.statueList[index].Y); if (WorldGen.StatuesWithTraps.Contains(index)) { WorldGen.PlaceStatueTrap(num11, num12); break; } break; case 3: Point point = Utils.SelectRandom <Point>(GenBase._random, pointArray); WorldGen.PlaceTile(num11, num12, (int)point.X, true, false, -1, (int)point.Y); break; } } } } using (List <Rectangle> .Enumerator enumerator = rectangleList1.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; buildData.ProcessRoom(current); } } bool flag1 = false; using (List <Rectangle> .Enumerator enumerator = rectangleList1.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; int j = current.Height - 1 + current.Y; int Style = j > (int)Main.worldSurface ? buildData.ChestStyle : 0; int num8 = 0; while (num8 < 10 && !(flag1 = WorldGen.AddBuriedChest(GenBase._random.Next(2, current.Width - 2) + current.X, j, 0, false, Style))) { ++num8; } if (!flag1) { int i = current.X + 2; while (i <= current.X + current.Width - 2 && !(flag1 = WorldGen.AddBuriedChest(i, j, 0, false, Style))) { ++i; } if (flag1) { break; } } else { break; } } } if (!flag1) { using (List <Rectangle> .Enumerator enumerator = rectangleList1.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; int j = current.Y - 1; int Style = j > (int)Main.worldSurface ? buildData.ChestStyle : 0; int num8 = 0; while (num8 < 10 && !(flag1 = WorldGen.AddBuriedChest(GenBase._random.Next(2, current.Width - 2) + current.X, j, 0, false, Style))) { ++num8; } if (!flag1) { int i = current.X + 2; while (i <= current.X + current.Width - 2 && !(flag1 = WorldGen.AddBuriedChest(i, j, 0, false, Style))) { ++i; } if (flag1) { break; } } else { break; } } } } if (!flag1) { for (int index = 0; index < 1000; ++index) { int i = GenBase._random.Next(rectangleList1[0].X - 30, rectangleList1[0].X + 30); int j = GenBase._random.Next(rectangleList1[0].Y - 30, rectangleList1[0].Y + 30); int Style = j > (int)Main.worldSurface ? buildData.ChestStyle : 0; if (WorldGen.AddBuriedChest(i, j, 0, false, Style)) { break; } } } if (buildData == CaveHouseBiome.BuildData.Jungle && this._sharpenerCount < GenBase._random.Next(2, 5)) { bool flag2 = false; using (List <Rectangle> .Enumerator enumerator = rectangleList1.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; int j = current.Height - 2 + current.Y; for (int index = 0; index < 10; ++index) { int i = GenBase._random.Next(2, current.Width - 2) + current.X; WorldGen.PlaceTile(i, j, 377, true, true, -1, 0); if (flag2 = GenBase._tiles[i, j].active() && (int)GenBase._tiles[i, j].type == 377) { break; } } if (!flag2) { int i = current.X + 2; while (i <= current.X + current.Width - 2 && !(flag2 = WorldGen.PlaceTile(i, j, 377, true, true, -1, 0))) { ++i; } if (flag2) { break; } } else { break; } } } if (flag2) { ++this._sharpenerCount; } } if (buildData == CaveHouseBiome.BuildData.Desert && this._extractinatorCount < GenBase._random.Next(2, 5)) { bool flag2 = false; using (List <Rectangle> .Enumerator enumerator = rectangleList1.GetEnumerator()) { while (enumerator.MoveNext()) { Rectangle current = enumerator.Current; int j = current.Height - 2 + current.Y; for (int index = 0; index < 10; ++index) { int i = GenBase._random.Next(2, current.Width - 2) + current.X; WorldGen.PlaceTile(i, j, 219, true, true, -1, 0); if (flag2 = GenBase._tiles[i, j].active() && (int)GenBase._tiles[i, j].type == 219) { break; } } if (!flag2) { int i = current.X + 2; while (i <= current.X + current.Width - 2 && !(flag2 = WorldGen.PlaceTile(i, j, 219, true, true, -1, 0))) { ++i; } if (flag2) { break; } } else { break; } } } if (flag2) { ++this._extractinatorCount; } } 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) { 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(origin.Y - result1.Y), (GenCondition) new Conditions.IsTile(new ushort[1] { (ushort)53 })), out result2) || !flag) { return(false); } result1.Y += 50; ShapeData data1 = new ShapeData(); ShapeData shapeData = new ShapeData(); Point point1 = new Point(origin.X, origin.Y + 20); Point point2 = new Point(origin.X, origin.Y + 30); float xScale = (float)(0.800000011920929 + (double)GenBase._random.NextFloat() * 0.5); if (!structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(point1.X - (int)(20.0 * (double)xScale), point1.Y - 20, (int)(40.0 * (double)xScale), 40), 0) || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(origin.X, result1.Y + 10, 1, origin.Y - result1.Y - 9), 2)) { return(false); } WorldUtils.Gen(point1, (GenShape) new Shapes.Slime(20, xScale, 1f), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.4), new Actions.ClearTile(true).Output(data1))); WorldUtils.Gen(point2, (GenShape) new Shapes.Mound(14, 14), Actions.Chain((GenAction) new Modifiers.Blotches(2, 1, 0.8), (GenAction) new Actions.SetTile((ushort)0, false, true), new Actions.SetFrames(true).Output(shapeData))); data1.Subtract(shapeData, point1, point2); WorldUtils.Gen(point1, (GenShape) new ModShapes.InnerOutline(data1, true), Actions.Chain((GenAction) new Actions.SetTile((ushort)2, false, true), (GenAction) new Actions.SetFrames(true))); WorldUtils.Gen(point1, (GenShape) new ModShapes.All(data1), Actions.Chain((GenAction) new Modifiers.RectangleMask(-40, 40, 0, 40), (GenAction) new Modifiers.IsEmpty(), (GenAction) new Actions.SetLiquid(0, byte.MaxValue))); WorldUtils.Gen(point1, (GenShape) new ModShapes.All(data1), Actions.Chain((GenAction) new Actions.PlaceWall((byte)68, true), (GenAction) new Modifiers.OnlyTiles(new ushort[1] { (ushort)2 }), (GenAction) new Modifiers.Offset(0, 1), (GenAction) new ActionVines(3, 5, 52))); ShapeData data2 = new ShapeData(); WorldUtils.Gen(new Point(origin.X, result1.Y + 10), (GenShape) new Shapes.Rectangle(1, origin.Y - result1.Y - 9), Actions.Chain((GenAction) new Modifiers.Blotches(2, 0.2), new Actions.ClearTile(false).Output(data2), (GenAction) new Modifiers.Expand(1), (GenAction) new Modifiers.OnlyTiles(new ushort[1] { (ushort)53 }), new Actions.SetTile((ushort)397, false, true).Output(data2))); WorldUtils.Gen(new Point(origin.X, result1.Y + 10), (GenShape) new ModShapes.All(data2), (GenAction) 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, (GenShape) new ModShapes.All(shapeData), Actions.Chain((GenAction) new Modifiers.Offset(0, -1), (GenAction) new Modifiers.OnlyTiles(new ushort[1] { (ushort)2 }), (GenAction) new Modifiers.Offset(0, -1), (GenAction) new ActionGrass())); structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(point1.X - (int)(20.0 * (double)xScale), point1.Y - 20, (int)(40.0 * (double)xScale), 40), 4); return(true); }
public override bool Place(Point origin, StructureMap structures) { if (!WorldUtils.Find(new Point(origin.X - 3, origin.Y), Searches.Chain(new Searches.Down(200), new Conditions.IsSolid().AreaAnd(6, 1)), out Point result)) { return(false); } if (!WorldUtils.Find(new Point(result.X, result.Y - 5), Searches.Chain(new Searches.Up(120), new Conditions.IsSolid().AreaOr(6, 1)), out Point result2) || result.Y - 5 - result2.Y > 60) { return(false); } if (result.Y - result2.Y < 30) { return(false); } if (!structures.CanPlace(new Rectangle(result.X - 30, result.Y - 60, 60, 90))) { return(false); } Dictionary <ushort, int> dictionary = new Dictionary <ushort, int>(); WorldUtils.Gen(new Point(result.X - 25, result.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(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 = (result.Y - result2.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 = 0.0 - 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(result.X + num6 + num11, result.Y - (i + 1) * 5), new Shapes.Rectangle(6 + Math.Abs(num10 - num6), 7), Actions.Chain(new Actions.RemoveWall(), new Actions.SetTile(383), new Actions.SetFrames())); WorldUtils.Gen(new Point(result.X + num6 + num11 + 2, result.Y - (i + 1) * 5), new Shapes.Rectangle(2 + Math.Abs(num10 - num6), 5), Actions.Chain(new Actions.ClearTile(frameNeighbors: true), new Actions.PlaceWall(78))); WorldUtils.Gen(new Point(result.X + num6 + 2, result.Y - i * 5), new Shapes.Rectangle(2, 2), Actions.Chain(new Actions.ClearTile(frameNeighbors: true), new Actions.PlaceWall(78))); 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(result.X + num14, result.Y - (int)((double)(num4 * 5) * num13)), new ShapeBranch(num15, GenBase._random.Next(12, 16)).OutputEndpoints(list), Actions.Chain(new Actions.SetTile(383), new Actions.SetFrames(frameNeighbors: true))); num12 = 6 - num12; } int num16 = (int)(Math.Sin((double)num4 / 12.0 * num7 * 3.1415927410125732) * num8); WorldUtils.Gen(new Point(result.X + 6 + num16, result.Y - num5), new ShapeBranch(-0.68539818525314333, GenBase._random.Next(16, 22)).OutputEndpoints(list), Actions.Chain(new Actions.SetTile(383), new Actions.SetFrames(frameNeighbors: true))); WorldUtils.Gen(new Point(result.X + num16, result.Y - num5), new ShapeBranch(-2.45619455575943, GenBase._random.Next(16, 22)).OutputEndpoints(list), Actions.Chain(new Actions.SetTile(383), new Actions.SetFrames(frameNeighbors: true))); foreach (Point item in list) { WorldUtils.Gen(item, new Shapes.Circle(4), Actions.Chain(new Modifiers.Blotches(4, 2), new Modifiers.SkipTiles(383), new Modifiers.SkipWalls(78), new Actions.SetTile(384), new Actions.SetFrames(frameNeighbors: true))); } for (int k = 0; k < 4; k++) { float angle = (float)k / 3f * 2f + 0.57075f; WorldUtils.Gen(result, new ShapeRoot(angle, GenBase._random.Next(40, 60)), new Actions.SetTile(383, setSelfFrames: true)); } WorldGen.AddBuriedChest(result.X + 3, result.Y - 1, (GenBase._random.Next(4) != 0) ? WorldGen.GetNextJungleChestItem() : 0, notNearOtherChests: false, 10); structures.AddStructure(new Rectangle(result.X - 30, result.Y - 30, 60, 60)); return(true); }
public override bool Place(Point origin, StructureMap structures) { if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(200), new Conditions.IsSolid()), out Point result) || result == origin) { return(false); } Rectangle room = GetRoom(result); Rectangle rectangle = GetRoom(new Point(room.Center.X, room.Y + 1)); Rectangle rectangle2 = GetRoom(new Point(room.Center.X, room.Y + room.Height + 10)); rectangle2.Y = room.Y + room.Height - 1; float num = RoomSolidPrecentage(rectangle); float num2 = 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 item4 in list) { WorldUtils.Gen(new Point(item4.X - 5, item4.Y - 5), new Shapes.Rectangle(item4.Width + 10, item4.Height + 10), new Actions.TileScanner(0, 59, 147, 1, 161, 53, 396, 397, 368, 367, 60, 70).Output(dictionary)); } List <Tuple <BuildData, int> > list2 = new List <Tuple <BuildData, int> >(); list2.Add(Tuple.Create(BuildData.Default, dictionary[0] + dictionary[1])); list2.Add(Tuple.Create(BuildData.Jungle, dictionary[59] + dictionary[60] * 10)); list2.Add(Tuple.Create(BuildData.Mushroom, dictionary[59] + dictionary[70] * 10)); list2.Add(Tuple.Create(BuildData.Snow, dictionary[147] + dictionary[161])); list2.Add(Tuple.Create(BuildData.Desert, dictionary[397] + dictionary[396] + dictionary[53])); list2.Add(Tuple.Create(BuildData.Granite, dictionary[368])); list2.Add(Tuple.Create(BuildData.Marble, dictionary[367])); list2.Sort(SortBiomeResults); BuildData item = list2[0].Item1; foreach (Rectangle item5 in list) { if (item != BuildData.Granite && WorldUtils.Find(new Point(item5.X - 2, item5.Y - 2), Searches.Chain(new Searches.Rectangle(item5.Width + 4, item5.Height + 4).RequireAll(mode: false), new Conditions.HasLava()), out Point _)) { return(false); } if (!structures.CanPlace(item5, _blacklistedTiles, 5)) { return(false); } } int num3 = room.X; int num4 = room.X + room.Width - 1; List <Rectangle> list3 = new List <Rectangle>(); foreach (Rectangle item6 in list) { num3 = Math.Min(num3, item6.X); num4 = Math.Max(num4, item6.X + item6.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) { continue; } 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 result3; bool flag = WorldUtils.Find(new Point(i, num6), Searches.Chain(new Searches.Down(num7), new Conditions.IsSolid()), out result3); if (num7 < 50) { flag = true; result3 = new Point(i, num6 + num7); } if (flag) { list3.Add(new Rectangle(i, num6, 1, result3.Y - num6)); } } } } List <Point> list4 = new List <Point>(); foreach (Rectangle item7 in list) { if (FindSideExit(new Rectangle(item7.X + item7.Width, item7.Y + 1, 1, item7.Height - 2), isLeft: false, out int exitY)) { list4.Add(new Point(item7.X + item7.Width - 1, exitY)); } if (FindSideExit(new Rectangle(item7.X, item7.Y + 1, 1, item7.Height - 2), isLeft: true, out exitY)) { list4.Add(new Point(item7.X, exitY)); } } 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 num8 = rectangle5.X - rectangle4.X; int num9 = rectangle4.X + rectangle4.Width - (rectangle5.X + rectangle5.Width); if (num8 > num9) { 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>(); if (FindVerticalExit(new Rectangle(rectangle.X + 2, rectangle.Y, rectangle.Width - 4, 1), isUp: true, out int exitX)) { list6.Add(new Point(exitX, rectangle.Y)); } if (FindVerticalExit(new Rectangle(rectangle2.X + 2, rectangle2.Y + rectangle2.Height - 1, rectangle2.Width - 4, 1), isUp: false, out exitX)) { list6.Add(new Point(exitX, rectangle2.Y + rectangle2.Height - 1)); } foreach (Rectangle item8 in list) { WorldUtils.Gen(new Point(item8.X, item8.Y), new Shapes.Rectangle(item8.Width, item8.Height), Actions.Chain(new Actions.SetTile(item.Tile), new Actions.SetFrames(frameNeighbors: true))); WorldUtils.Gen(new Point(item8.X + 1, item8.Y + 1), new Shapes.Rectangle(item8.Width - 2, item8.Height - 2), Actions.Chain(new Actions.ClearTile(frameNeighbors: true), new Actions.PlaceWall(item.Wall))); structures.AddStructure(item8, 8); } foreach (Tuple <Point, Point> item9 in list5) { Point item2 = item9.Item1; Point item3 = item9.Item2; int num10 = (item3.X > item2.X) ? 1 : (-1); ShapeData shapeData = new ShapeData(); for (int m = 0; m < item3.Y - item2.Y; m++) { shapeData.Add(num10 * (m + 1), m); } WorldUtils.Gen(item2, new ModShapes.All(shapeData), Actions.Chain(new Actions.PlaceTile(19, item.PlatformStyle), new Actions.SetSlope((num10 == 1) ? 1 : 2), new Actions.SetFrames(frameNeighbors: true))); WorldUtils.Gen(new Point(item2.X + ((num10 == 1) ? 1 : (-4)), item2.Y - 1), new Shapes.Rectangle(4, 1), Actions.Chain(new Actions.Clear(), new Actions.PlaceWall(item.Wall), new Actions.PlaceTile(19, item.PlatformStyle), new Actions.SetFrames(frameNeighbors: true))); } foreach (Point item10 in list4) { WorldUtils.Gen(item10, new Shapes.Rectangle(1, 3), new Actions.ClearTile(frameNeighbors: true)); WorldGen.PlaceTile(item10.X, item10.Y, 10, mute: true, forced: true, -1, item.DoorStyle); } foreach (Point item11 in list6) { WorldUtils.Gen(item11, new Shapes.Rectangle(3, 1), Actions.Chain(new Actions.ClearMetadata(), new Actions.PlaceTile(19, item.PlatformStyle), new Actions.SetFrames(frameNeighbors: true))); } foreach (Rectangle item12 in list3) { if (item12.Height > 1 && GenBase._tiles[item12.X, item12.Y - 1].type != 19) { WorldUtils.Gen(new Point(item12.X, item12.Y), new Shapes.Rectangle(item12.Width, item12.Height), Actions.Chain(new Actions.SetTile(124), new Actions.SetFrames(frameNeighbors: true))); Tile tile = GenBase._tiles[item12.X, item12.Y + item12.Height]; tile.slope(0); tile.halfBrick(halfBrick: false); } } Point[] choices = new Point[7] { 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 item13 in list) { int num11 = item13.Width / 8; int num12 = item13.Width / (num11 + 1); int num13 = GenBase._random.Next(2); for (int n = 0; n < num11; n++) { int num14 = (n + 1) * num12 + item13.X; switch (n + num13 % 2) { case 0: { int num15 = item13.Y + Math.Min(item13.Height / 2, item13.Height - 5); Vector2 vector = WorldGen.randHousePicture(); int type = (int)vector.X; int style = (int)vector.Y; if (!WorldGen.nearPicture(num14, num15)) { WorldGen.PlaceTile(num14, num15, type, mute: true, forced: false, -1, style); } break; } case 1: { int num15 = item13.Y + 1; WorldGen.PlaceTile(num14, num15, 34, mute: true, forced: false, -1, GenBase._random.Next(6)); for (int num16 = -1; num16 < 2; num16++) { for (int num17 = 0; num17 < 3; num17++) { GenBase._tiles[num16 + num14, num17 + num15].frameX += 54; } } break; } } } int num18 = item13.Width / 8 + 3; WorldGen.SetupStatueList(); while (num18 > 0) { int num19 = GenBase._random.Next(item13.Width - 3) + 1 + item13.X; int num20 = item13.Y + item13.Height - 2; switch (GenBase._random.Next(4)) { case 0: WorldGen.PlaceSmallPile(num19, num20, GenBase._random.Next(31, 34), 1, 185); break; case 1: WorldGen.PlaceTile(num19, num20, 186, mute: true, forced: false, -1, GenBase._random.Next(22, 26)); break; case 2: { int num21 = GenBase._random.Next(2, WorldGen.statueList.Length); WorldGen.PlaceTile(num19, num20, WorldGen.statueList[num21].X, mute: true, forced: false, -1, WorldGen.statueList[num21].Y); if (WorldGen.StatuesWithTraps.Contains(num21)) { WorldGen.PlaceStatueTrap(num19, num20); } break; } case 3: { Point point = Utils.SelectRandom(GenBase._random, choices); WorldGen.PlaceTile(num19, num20, point.X, mute: true, forced: false, -1, point.Y); break; } } num18--; } } foreach (Rectangle item14 in list) { item.ProcessRoom(item14); } bool flag2 = false; foreach (Rectangle item15 in list) { int num22 = item15.Height - 1 + item15.Y; int style2 = (num22 > (int)Main.worldSurface) ? item.ChestStyle : 0; for (int num23 = 0; num23 < 10; num23++) { int i2 = GenBase._random.Next(2, item15.Width - 2) + item15.X; if (flag2 = WorldGen.AddBuriedChest(i2, num22, 0, notNearOtherChests: false, style2)) { break; } } if (flag2) { break; } for (int num24 = item15.X + 2; num24 <= item15.X + item15.Width - 2; num24++) { if (flag2 = WorldGen.AddBuriedChest(num24, num22, 0, notNearOtherChests: false, style2)) { break; } } if (flag2) { break; } } if (!flag2) { foreach (Rectangle item16 in list) { int num25 = item16.Y - 1; int style3 = (num25 > (int)Main.worldSurface) ? item.ChestStyle : 0; for (int num26 = 0; num26 < 10; num26++) { int i3 = GenBase._random.Next(2, item16.Width - 2) + item16.X; if (flag2 = WorldGen.AddBuriedChest(i3, num25, 0, notNearOtherChests: false, style3)) { break; } } if (flag2) { break; } for (int num27 = item16.X + 2; num27 <= item16.X + item16.Width - 2; num27++) { if (flag2 = WorldGen.AddBuriedChest(num27, num25, 0, notNearOtherChests: false, style3)) { break; } } if (flag2) { break; } } } if (!flag2) { for (int num28 = 0; num28 < 1000; num28++) { int i4 = GenBase._random.Next(list[0].X - 30, list[0].X + 30); int num29 = GenBase._random.Next(list[0].Y - 30, list[0].Y + 30); int style4 = (num29 > (int)Main.worldSurface) ? item.ChestStyle : 0; if (flag2 = WorldGen.AddBuriedChest(i4, num29, 0, notNearOtherChests: false, style4)) { break; } } } if (item == BuildData.Jungle && _sharpenerCount < GenBase._random.Next(2, 5)) { bool flag3 = false; foreach (Rectangle item17 in list) { int num30 = item17.Height - 2 + item17.Y; for (int num31 = 0; num31 < 10; num31++) { int num32 = GenBase._random.Next(2, item17.Width - 2) + item17.X; WorldGen.PlaceTile(num32, num30, 377, mute: true, forced: true); if (flag3 = (GenBase._tiles[num32, num30].active() && GenBase._tiles[num32, num30].type == 377)) { break; } } if (flag3) { break; } for (int num33 = item17.X + 2; num33 <= item17.X + item17.Width - 2; num33++) { if (flag3 = WorldGen.PlaceTile(num33, num30, 377, mute: true, forced: true)) { break; } } if (flag3) { break; } } if (flag3) { _sharpenerCount++; } } if (item == BuildData.Desert && _extractinatorCount < GenBase._random.Next(2, 5)) { bool flag4 = false; foreach (Rectangle item18 in list) { int num34 = item18.Height - 2 + item18.Y; for (int num35 = 0; num35 < 10; num35++) { int num36 = GenBase._random.Next(2, item18.Width - 2) + item18.X; WorldGen.PlaceTile(num36, num34, 219, mute: true, forced: true); if (flag4 = (GenBase._tiles[num36, num34].active() && GenBase._tiles[num36, num34].type == 219)) { break; } } if (flag4) { break; } for (int num37 = item18.X + 2; num37 <= item18.X + item18.Width - 2; num37++) { if (flag4 = WorldGen.PlaceTile(num37, num34, 219, mute: true, forced: true)) { break; } } if (flag4) { break; } } if (flag4) { _extractinatorCount++; } } return(true); }
// Token: 0x06000FD4 RID: 4052 RVA: 0x003FB3F4 File Offset: 0x003F95F4 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; if (!WorldUtils.Find(origin, Searches.Chain((num > 0.0) ? (GenSearch) new Searches.Right(40) : new Searches.Left(40), 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) })); Point point; bool arg_2B0_0 = true & 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 point); int num2 = (GenBase._random.Next(4) == 0) ? 3 : 7; Point point2; if (!(arg_2B0_0 & WorldUtils.Find(new Point(origin.X - ((num > 0.0) ? (-num2) : num2), origin.Y - 3), Searches.Chain(new Searches.Down(10), new GenCondition[] { new Conditions.IsSolid() }), out point2))) { return(false); } point.Y--; point2.Y--; Tile expr_2E7 = GenBase._tiles[point.X, point.Y + 1]; expr_2E7.slope(0); expr_2E7.halfBrick(false); for (int i = -1; i <= 1; i++) { WorldUtils.ClearTile(point2.X + i, point2.Y, false); Tile tile = GenBase._tiles[point2.X + i, point2.Y + 1]; if (!WorldGen.SolidOrSlopedTile(tile)) { tile.ResetToType(1); tile.active(true); } tile.slope(0); tile.halfBrick(false); WorldUtils.TileFrame(point2.X + i, point2.Y + 1, true); } WorldGen.PlaceTile(point.X, point.Y, 141, false, false, -1, 0); WorldGen.PlaceTile(point2.X, point2.Y, 411, true, true, -1, 0); WorldUtils.WireLine(point, point2); structures.AddStructure(area, 5); return(true); }
public override bool Place(Point origin, StructureMap structures) { if (WorldGen.BiomeTileCheck(origin.X, origin.Y)) { return(false); } if (this._slabs == null) { this._slabs = new MarbleBiome.Slab[56, 26]; } int num1 = GenBase._random.Next(80, 150) / 3; int num2 = GenBase._random.Next(40, 60) / 3; int num3 = (num2 * 3 - GenBase._random.Next(20, 30)) / 3; origin.X -= num1 * 3 / 2; origin.Y -= num2 * 3 / 2; for (int index1 = -1; index1 < num1 + 1; ++index1) { double num4 = (double)(index1 - num1 / 2) / (double)num1 + 0.5; int num5 = (int)((0.5 - Math.Abs(num4 - 0.5)) * 5.0) - 2; for (int index2 = -1; index2 < num2 + 1; ++index2) { bool hasWall = true; bool flag1 = false; bool flag2 = MarbleBiome.IsGroupSolid(index1 * 3 + origin.X, index2 * 3 + origin.Y, 3); int num6 = Math.Abs(index2 - num2 / 2) - num3 / 4 + num5; if (num6 > 3) { flag1 = flag2; hasWall = false; } else if (num6 > 0) { flag1 = index2 - num2 / 2 > 0 | flag2; hasWall = index2 - num2 / 2 < 0 || num6 <= 2; } else if (num6 == 0) { flag1 = GenBase._random.Next(2) == 0 && index2 - num2 / 2 > 0 | flag2; } if (Math.Abs(num4 - 0.5) > 0.349999994039536 + (double)GenBase._random.NextFloat() * 0.100000001490116 && !flag2) { hasWall = false; flag1 = false; } this._slabs[index1 + 1, index2 + 1] = MarbleBiome.Slab.Create(flag1 ? new MarbleBiome.SlabState(MarbleBiome.SlabStates.Solid) : new MarbleBiome.SlabState(MarbleBiome.SlabStates.Empty), hasWall); } } for (int index1 = 0; index1 < num1; ++index1) { for (int index2 = 0; index2 < num2; ++index2) { this.SmoothSlope(index1 + 1, index2 + 1); } } int num7 = num1 / 2; int val1 = num2 / 2; int num8 = (val1 + 1) * (val1 + 1); float num9 = (float)((double)GenBase._random.NextFloat() * 2.0 - 1.0); float num10 = (float)((double)GenBase._random.NextFloat() * 2.0 - 1.0); float num11 = (float)((double)GenBase._random.NextFloat() * 2.0 - 1.0); float num12 = 0.0f; for (int index1 = 0; index1 <= num1; ++index1) { float num4 = (float)val1 / (float)num7 * (float)(index1 - num7); int num5 = Math.Min(val1, (int)Math.Sqrt((double)Math.Max(0.0f, (float)num8 - num4 * num4))); if (index1 < num1 / 2) { num12 += MathHelper.Lerp(num9, num10, (float)index1 / (float)(num1 / 2)); } else { num12 += MathHelper.Lerp(num10, num11, (float)((double)index1 / (double)(num1 / 2) - 1.0)); } for (int index2 = val1 - num5; index2 <= val1 + num5; ++index2) { this.PlaceSlab(this._slabs[index1 + 1, index2 + 1], index1 * 3 + origin.X, index2 * 3 + origin.Y + (int)num12, 3); } } structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(origin.X, origin.Y, num1 * 3, num2 * 3), 8); 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 Actions.Scanner(ref2), new Modifiers.IsSolid(), new Actions.Scanner(@ref))); if (@ref.Value < ref2.Value - 5) { return(false); } int num = GenBase._random.Next(6, 10); int num2 = GenBase._random.Next(5); if (!structures.CanPlace(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2))) { return(false); } ShapeData data = new ShapeData(); Point origin2 = origin; Shapes.Slime shape = new Shapes.Slime(num); GenAction[] array = new GenAction[6] { new Modifiers.Blotches(num2, num2, num2, 1).Output(data), new Modifiers.Offset(0, -2), new Modifiers.OnlyTiles(53), new Actions.SetTile(397, setSelfFrames: true), null, null }; byte[] types = new byte[1]; array[4] = new Modifiers.OnlyWalls(types); array[5] = new Actions.PlaceWall(16); WorldUtils.Gen(origin2, shape, Actions.Chain(array)); Point origin3 = origin; ModShapes.All shape2 = new ModShapes.All(data); GenAction[] array2 = new GenAction[5] { new Actions.ClearTile(), new Actions.SetLiquid(0, 0), new Actions.SetFrames(frameNeighbors: true), null, null }; byte[] types2 = new byte[1]; array2[3] = new Modifiers.OnlyWalls(types2); array2[4] = new Actions.PlaceWall(16); WorldUtils.Gen(origin3, shape2, Actions.Chain(array2)); if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(10), new Conditions.IsSolid()), out Point result)) { return(false); } int num3 = result.Y - 1; bool flag = GenBase._random.Next() % 2 == 0; if (GenBase._random.Next() % 10 != 0) { int num4 = GenBase._random.Next(1, 4); int num5 = flag ? 4 : (-(num >> 1)); for (int i = 0; i < num4; i++) { int num6 = GenBase._random.Next(1, 3); for (int j = 0; j < num6; j++) { WorldGen.PlaceTile(origin.X + num5 - i, num3 - j, 331); } } } int num7 = (num - 3) * ((!flag) ? 1 : (-1)); if (GenBase._random.Next() % 10 != 0) { WorldGen.PlaceTile(origin.X + num7, num3, 186); } if (GenBase._random.Next() % 10 != 0) { WorldGen.PlaceTile(origin.X, num3, 215, mute: true); if (GenBase._tiles[origin.X, num3].active() && GenBase._tiles[origin.X, num3].type == 215) { GenBase._tiles[origin.X, num3].frameY += 36; GenBase._tiles[origin.X - 1, num3].frameY += 36; GenBase._tiles[origin.X + 1, num3].frameY += 36; GenBase._tiles[origin.X, num3 - 1].frameY += 36; GenBase._tiles[origin.X - 1, num3 - 1].frameY += 36; GenBase._tiles[origin.X + 1, num3 - 1].frameY += 36; } } structures.AddStructure(new Rectangle(origin.X - num, origin.Y - num, num * 2, num * 2), 4); return(true); }
public override bool Place(Point origin, StructureMap structures) { var count1 = new Ref <int>(0); var count2 = new Ref <int>(0); WorldUtils.Gen(origin, new Shapes.Circle(10), Actions.Chain((GenAction) new Actions.Scanner(count2), (GenAction) new Modifiers.IsSolid(), (GenAction) new Actions.Scanner(count1))); if (count1.Value < count2.Value - 5) { return(false); } var radius = _random.Next(6, 10); var num1 = _random.Next(5); if (!structures.CanPlace( new Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 0)) { return(false); } var data = new ShapeData(); WorldUtils.Gen(origin, new Shapes.Slime(radius), Actions.Chain( new Modifiers.Blotches(num1, num1, num1, 1, 0.3).Output(data), (GenAction) new Modifiers.Offset(0, -2), (GenAction) new Modifiers.OnlyTiles((ushort)53), (GenAction) new Actions.SetTile(397, true, true), (GenAction) new Modifiers.OnlyWalls(new byte[1]), (GenAction) new Actions.PlaceWall(16, true))); WorldUtils.Gen(origin, new ModShapes.All(data), Actions.Chain((GenAction) new Actions.ClearTile(false), (GenAction) new Actions.SetLiquid(0, 0), (GenAction) new Actions.SetFrames(true), (GenAction) new Modifiers.OnlyWalls(new byte[1]), (GenAction) new Actions.PlaceWall(16, true))); Point result; if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(10), (GenCondition) new Conditions.IsSolid()), out result)) { return(false); } var j = result.Y - 1; var flag = _random.Next() % 2 == 0; if (_random.Next() % 10 != 0) { var num2 = _random.Next(1, 4); var num3 = flag ? 4 : -(radius >> 1); for (var index1 = 0; index1 < num2; ++index1) { var num4 = _random.Next(1, 3); for (var index2 = 0; index2 < num4; ++index2) { WorldGen.PlaceTile(origin.X + num3 - index1, j - index2, 331, false, false, -1, 0); } } } var num5 = (radius - 3) * (flag ? -1 : 1); if (_random.Next() % 10 != 0) { WorldGen.PlaceTile(origin.X + num5, j, 186, false, false, -1, 0); } if (_random.Next() % 10 != 0) { WorldGen.PlaceTile(origin.X, j, 215, true, false, -1, 0); if (_tiles[origin.X, j].active() && _tiles[origin.X, j].type == 215) { _tiles[origin.X, j].frameY += 36; _tiles[origin.X - 1, j].frameY += 36; _tiles[origin.X + 1, j].frameY += 36; _tiles[origin.X, j - 1].frameY += 36; _tiles[origin.X - 1, j - 1].frameY += 36; _tiles[origin.X + 1, j - 1].frameY += 36; } } structures.AddStructure( new Rectangle(origin.X - radius, origin.Y - radius, radius * 2, radius * 2), 4); return(true); }
// Token: 0x06000FB3 RID: 4019 RVA: 0x003F7BAC File Offset: 0x003F5DAC 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(); WorldUtils.Gen(origin, new Shapes.Slime(num), Actions.Chain(new GenAction[] { new Modifiers.Blotches(num2, num2, num2, 1, 0.3).Output(data), new Modifiers.Offset(0, -2), new Modifiers.OnlyTiles(new ushort[] { 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 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) })); 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_2CD = GenBase._tiles[origin.X, num3]; expr_2CD.frameY += 36; Tile expr_2F0 = GenBase._tiles[origin.X - 1, num3]; expr_2F0.frameY += 36; Tile expr_313 = GenBase._tiles[origin.X + 1, num3]; expr_313.frameY += 36; Tile expr_336 = GenBase._tiles[origin.X, num3 - 1]; expr_336.frameY += 36; Tile expr_35B = GenBase._tiles[origin.X - 1, num3 - 1]; expr_35B.frameY += 36; Tile expr_380 = GenBase._tiles[origin.X + 1, num3 - 1]; expr_380.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.BiomeTileCheck(origin.X, origin.Y)) { return(false); } if (_slabs == null) { _slabs = new Slab[56, 26]; } int num = GenBase._random.Next(80, 150) / 3; int num2 = GenBase._random.Next(40, 60) / 3; int num3 = (num2 * 3 - GenBase._random.Next(20, 30)) / 3; origin.X -= num * 3 / 2; origin.Y -= num2 * 3 / 2; for (int i = -1; i < num + 1; i++) { double num4 = (double)(i - num / 2) / (double)num + 0.5; int num5 = (int)((0.5 - Math.Abs(num4 - 0.5)) * 5.0) - 2; for (int j = -1; j < num2 + 1; j++) { bool hasWall = true; bool flag = false; bool flag2 = IsGroupSolid(i * 3 + origin.X, j * 3 + origin.Y, 3); int num6 = Math.Abs(j - num2 / 2) - num3 / 4 + num5; if (num6 > 3) { flag = flag2; hasWall = false; } else if (num6 > 0) { flag = j - num2 / 2 > 0 || flag2; hasWall = j - num2 / 2 < 0 || num6 <= 2; } else if (num6 == 0) { flag = GenBase._random.Next(2) == 0 && (j - num2 / 2 > 0 || flag2); } if (Math.Abs(num4 - 0.5) > (double)(0.35f + GenBase._random.NextFloat() * 0.1f) && !flag2) { hasWall = false; flag = false; } _slabs[i + 1, j + 1] = Slab.Create(flag ? new SlabState(SlabStates.Solid) : new SlabState(SlabStates.Empty), hasWall); } } for (int k = 0; k < num; k++) { for (int l = 0; l < num2; l++) { SmoothSlope(k + 1, l + 1); } } int num7 = num / 2; int num8 = num2 / 2; int num9 = (num8 + 1) * (num8 + 1); float value = GenBase._random.NextFloat() * 2f - 1f; float num10 = GenBase._random.NextFloat() * 2f - 1f; float value2 = GenBase._random.NextFloat() * 2f - 1f; float num11 = 0f; for (int m = 0; m <= num; m++) { float num12 = (float)num8 / (float)num7 * (float)(m - num7); int num13 = Math.Min(num8, (int)Math.Sqrt(Math.Max(0f, (float)num9 - num12 * num12))); num11 = ((m >= num / 2) ? (num11 + MathHelper.Lerp(num10, value2, (float)m / (float)(num / 2) - 1f)) : (num11 + MathHelper.Lerp(value, num10, (float)m / (float)(num / 2)))); for (int n = num8 - num13; n <= num8 + num13; n++) { PlaceSlab(_slabs[m + 1, n + 1], m * 3 + origin.X, n * 3 + origin.Y + (int)num11, 3); } } structures.AddStructure(new Rectangle(origin.X, origin.Y, num * 3, num2 * 3), 8); 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 result1; if (!WorldUtils.Find(new Point(origin.X - 3, origin.Y), Searches.Chain((GenSearch) new Searches.Down(200), new Conditions.IsSolid().AreaAnd(6, 1)), out result1)) { return(false); } Point result2; if (!WorldUtils.Find(new Point(result1.X, result1.Y - 5), Searches.Chain((GenSearch) new Searches.Up(120), new Conditions.IsSolid().AreaOr(6, 1)), out result2) || result1.Y - 5 - result2.Y > 60 || (result1.Y - result2.Y < 30 || !structures.CanPlace(new Microsoft.Xna.Framework.Rectangle(result1.X - 30, result1.Y - 60, 60, 90), 0))) { return(false); } Dictionary <ushort, int> resultsOutput = new Dictionary <ushort, int>(); WorldUtils.Gen(new Point(result1.X - 25, result1.Y - 25), (GenShape) new Shapes.Rectangle(50, 50), (GenAction) new Actions.TileScanner(new ushort[4] { (ushort)0, (ushort)59, (ushort)147, (ushort)1 }).Output(resultsOutput)); int num1 = resultsOutput[(ushort)0] + resultsOutput[(ushort)1]; int num2 = resultsOutput[(ushort)59]; if (resultsOutput[(ushort)147] > num2 || num1 > num2 || num2 < 50) { return(false); } int num3 = (result1.Y - result2.Y - 9) / 5; int num4 = num3 * 5; int num5 = 0; double num6 = GenBase._random.NextDouble() + 1.0; double num7 = GenBase._random.NextDouble() + 2.0; if (GenBase._random.Next(2) == 0) { num7 = -num7; } for (int index = 0; index < num3; ++index) { int num8 = (int)(Math.Sin((double)(index + 1) / 12.0 * num6 * 3.14159274101257) * num7); int num9 = num8 < num5 ? num8 - num5 : 0; WorldUtils.Gen(new Point(result1.X + num5 + num9, result1.Y - (index + 1) * 5), (GenShape) new Shapes.Rectangle(6 + Math.Abs(num8 - num5), 7), Actions.Chain((GenAction) new Actions.RemoveWall(), (GenAction) new Actions.SetTile((ushort)383, false, true), (GenAction) new Actions.SetFrames(false))); WorldUtils.Gen(new Point(result1.X + num5 + num9 + 2, result1.Y - (index + 1) * 5), (GenShape) new Shapes.Rectangle(2 + Math.Abs(num8 - num5), 5), Actions.Chain((GenAction) new Actions.ClearTile(true), (GenAction) new Actions.PlaceWall((byte)78, true))); WorldUtils.Gen(new Point(result1.X + num5 + 2, result1.Y - index * 5), (GenShape) new Shapes.Rectangle(2, 2), Actions.Chain((GenAction) new Actions.ClearTile(true), (GenAction) new Actions.PlaceWall((byte)78, true))); num5 = num8; } int num10 = 6; if (num7 < 0.0) { num10 = 0; } List <Point> endpoints = new List <Point>(); for (int index = 0; index < 2; ++index) { double num8 = ((double)index + 1.0) / 3.0; int num9 = num10 + (int)(Math.Sin((double)num3 * num8 / 12.0 * num6 * 3.14159274101257) * num7); double angle = GenBase._random.NextDouble() * 0.785398185253143 - 0.785398185253143 - 0.200000002980232; if (num10 == 0) { angle -= 1.57079637050629; } WorldUtils.Gen(new Point(result1.X + num9, result1.Y - (int)((double)(num3 * 5) * num8)), (GenShape) new ShapeBranch(angle, (double)GenBase._random.Next(12, 16)).OutputEndpoints(endpoints), Actions.Chain((GenAction) new Actions.SetTile((ushort)383, false, true), (GenAction) new Actions.SetFrames(true))); num10 = 6 - num10; } int num11 = (int)(Math.Sin((double)num3 / 12.0 * num6 * 3.14159274101257) * num7); WorldUtils.Gen(new Point(result1.X + 6 + num11, result1.Y - num4), (GenShape) new ShapeBranch(-0.685398185253143, (double)GenBase._random.Next(16, 22)).OutputEndpoints(endpoints), Actions.Chain((GenAction) new Actions.SetTile((ushort)383, false, true), (GenAction) new Actions.SetFrames(true))); WorldUtils.Gen(new Point(result1.X + num11, result1.Y - num4), (GenShape) new ShapeBranch(-2.45619455575943, (double)GenBase._random.Next(16, 22)).OutputEndpoints(endpoints), Actions.Chain((GenAction) new Actions.SetTile((ushort)383, false, true), (GenAction) new Actions.SetFrames(true))); foreach (Point origin1 in endpoints) { Shapes.Circle circle = new Shapes.Circle(4); GenAction action = Actions.Chain((GenAction) new Modifiers.Blotches(4, 2, 0.3), (GenAction) new Modifiers.SkipTiles(new ushort[1] { (ushort)383 }), (GenAction) new Modifiers.SkipWalls(new byte[1] { (byte)78 }), (GenAction) new Actions.SetTile((ushort)384, false, true), (GenAction) new Actions.SetFrames(true)); WorldUtils.Gen(origin1, (GenShape)circle, action); } for (int index = 0; index < 4; ++index) { float angle = (float)((double)index / 3.0 * 2.0 + 0.570749998092651); WorldUtils.Gen(result1, (GenShape) new ShapeRoot(angle, (float)GenBase._random.Next(40, 60), 4f, 1f), (GenAction) new Actions.SetTile((ushort)383, true, true)); } WorldGen.AddBuriedChest(result1.X + 3, result1.Y - 1, GenBase._random.Next(4) == 0 ? 0 : WorldGen.GetNextJungleChestItem(), false, 10); structures.AddStructure(new Microsoft.Xna.Framework.Rectangle(result1.X - 30, result1.Y - 30, 60, 60), 0); 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) { if (WorldGen.SolidTile(origin.X, origin.Y)) { return(false); } ushort type = Utils.SelectRandom <ushort>(GenBase._random, new ushort[4] { 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 num1 = GenBase._random.NextDouble() * 2.0 - 1.0; if (!WorldUtils.Find(origin, Searches.Chain(num1 > 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)num1, 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); } Microsoft.Xna.Framework.Rectangle area = new Microsoft.Xna.Framework.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)(num1 * -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; bool flag = ((true ? 1 : 0) & (WorldUtils.Find(new Point(origin.X - (num1 > 0.0 ? 3 : -3), origin.Y - 3), Searches.Chain((GenSearch) new Searches.Down(10), (GenCondition) new Conditions.IsSolid()), out result1) ? 1 : 0)) != 0; int num2 = GenBase._random.Next(4) == 0 ? 3 : 7; Point result2; if (((flag ? 1 : 0) & (WorldUtils.Find(new Point(origin.X - (num1 > 0.0 ? -num2 : num2), 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 (WorldGen.SolidTile(origin.X, origin.Y)) { return(false); } ushort type = Utils.SelectRandom <ushort>(GenBase._random, (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; if (!WorldUtils.Find(origin, Searches.Chain((num > 0.0) ? ((GenSearch) new Searches.Right(40)) : ((GenSearch) new Searches.Left(40)), new Conditions.IsSolid()), out origin)) { return(false); } if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(80), 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 Modifiers.Blotches(), 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)) { return(false); } WorldUtils.Gen(origin, new ModShapes.All(shapeData), new Actions.SetTile(type, true)); WorldUtils.Gen(new Point(origin.X - (int)(num * -5.0), origin.Y - 5), new Shapes.Circle(5), Actions.Chain(new Modifiers.Blotches(), new Actions.ClearTile(true))); bool flag = true; Point result; flag &= WorldUtils.Find(new Point(origin.X - ((num > 0.0) ? 3 : (-3)), origin.Y - 3), Searches.Chain(new Searches.Down(10), new Conditions.IsSolid()), out result); Point result2; if (!(flag & WorldUtils.Find(new Point(origin.X - ((num > 0.0) ? (-3) : 3), origin.Y - 3), Searches.Chain(new Searches.Down(10), new Conditions.IsSolid()), out result2))) { return(false); } result.Y--; result2.Y--; Tile tile = GenBase._tiles[result.X, result.Y + 1]; tile.slope(0); tile.halfBrick(false); for (int i = -1; i <= 1; i++) { WorldUtils.ClearTile(result2.X + i, result2.Y); Tile tile2 = GenBase._tiles[result2.X + i, result2.Y + 1]; if (!WorldGen.SolidOrSlopedTile(tile2)) { tile2.ResetToType(1); tile2.active(true); } tile2.slope(0); tile2.halfBrick(false); WorldUtils.TileFrame(result2.X + i, result2.Y + 1, true); } WorldGen.PlaceTile(result.X, result.Y, 141); WorldGen.PlaceTile(result2.X, result2.Y, 411, true, true); WorldUtils.WireLine(result, result2); structures.AddStructure(area, 5); return(true); }
public override bool Place(Point origin, StructureMap structures) { Point result1; if (!WorldUtils.Find(origin, Searches.Chain((GenSearch) new Searches.Down(200), (GenCondition) new Conditions.IsSolid()), out result1) || result1 == origin) { return(false); } Microsoft.Xna.Framework.Rectangle room1 = this.GetRoom(result1); Microsoft.Xna.Framework.Rectangle room2 = this.GetRoom(new Point(room1.Center.X, room1.Y + 1)); Microsoft.Xna.Framework.Rectangle room3 = this.GetRoom(new Point(room1.Center.X, room1.Y + room1.Height + 10)); room3.Y = room1.Y + room1.Height - 1; float num1 = this.RoomSolidPrecentage(room2); float num2 = this.RoomSolidPrecentage(room3); room1.Y += 3; room2.Y += 3; room3.Y += 3; List <Microsoft.Xna.Framework.Rectangle> rectangleList1 = new List <Microsoft.Xna.Framework.Rectangle>(); if ((double)GenBase._random.NextFloat() > (double)num1 + 0.200000002980232) { rectangleList1.Add(room2); } else { room2 = room1; } rectangleList1.Add(room1); if ((double)GenBase._random.NextFloat() > (double)num2 + 0.200000002980232) { rectangleList1.Add(room3); } else { room3 = room1; } foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1) { if (rectangle.Y + rectangle.Height > Main.maxTilesY - 220) { return(false); } } Dictionary <ushort, int> resultsOutput = new Dictionary <ushort, int>(); foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1) { WorldUtils.Gen(new Point(rectangle.X - 10, rectangle.Y - 10), (GenShape) new Shapes.Rectangle(rectangle.Width + 20, rectangle.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 <CaveHouseBiome.BuildData, int> > tupleList1 = new List <Tuple <CaveHouseBiome.BuildData, int> >(); tupleList1.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Default, resultsOutput[(ushort)0] + resultsOutput[(ushort)1])); tupleList1.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Jungle, resultsOutput[(ushort)59] + resultsOutput[(ushort)60] * 10)); tupleList1.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Mushroom, resultsOutput[(ushort)59] + resultsOutput[(ushort)70] * 10)); tupleList1.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Snow, resultsOutput[(ushort)147] + resultsOutput[(ushort)161])); tupleList1.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Desert, resultsOutput[(ushort)397] + resultsOutput[(ushort)396] + resultsOutput[(ushort)53])); tupleList1.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Granite, resultsOutput[(ushort)368])); tupleList1.Add(Tuple.Create <CaveHouseBiome.BuildData, int>(CaveHouseBiome.BuildData.Marble, resultsOutput[(ushort)367])); Comparison <Tuple <CaveHouseBiome.BuildData, int> > comparison = new Comparison <Tuple <CaveHouseBiome.BuildData, int> >(this.SortBiomeResults); tupleList1.Sort(comparison); int index1 = 0; CaveHouseBiome.BuildData buildData = tupleList1[index1].Item1; foreach (Microsoft.Xna.Framework.Rectangle area in rectangleList1) { if (buildData != CaveHouseBiome.BuildData.Granite) { Point result2; if (WorldUtils.Find(new Point(area.X - 2, area.Y - 2), Searches.Chain(new Searches.Rectangle(area.Width + 4, area.Height + 4).RequireAll(false), (GenCondition) new Conditions.HasLava()), out result2)) { return(false); } } if (!structures.CanPlace(area, CaveHouseBiome._blacklistedTiles, 5)) { return(false); } } int val1_1 = room1.X; int val1_2 = room1.X + room1.Width - 1; List <Microsoft.Xna.Framework.Rectangle> rectangleList2 = new List <Microsoft.Xna.Framework.Rectangle>(); foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1) { val1_1 = Math.Min(val1_1, rectangle.X); val1_2 = Math.Max(val1_2, rectangle.X + rectangle.Width - 1); } int num3 = 6; while (num3 > 4 && (val1_2 - val1_1) % num3 != 0) { --num3; } int x1 = val1_1; while (x1 <= val1_2) { for (int index2 = 0; index2 < rectangleList1.Count; ++index2) { Microsoft.Xna.Framework.Rectangle rectangle = rectangleList1[index2]; if (x1 >= rectangle.X && x1 < rectangle.X + rectangle.Width) { int y = rectangle.Y + rectangle.Height; int num4 = 50; for (int index3 = index2 + 1; index3 < rectangleList1.Count; ++index3) { if (x1 >= rectangleList1[index3].X && x1 < rectangleList1[index3].X + rectangleList1[index3].Width) { num4 = Math.Min(num4, rectangleList1[index3].Y - y); } } if (num4 > 0) { Point result2; bool flag = WorldUtils.Find(new Point(x1, y), Searches.Chain((GenSearch) new Searches.Down(num4), (GenCondition) new Conditions.IsSolid()), out result2); if (num4 < 50) { flag = true; result2 = new Point(x1, y + num4); } if (flag) { rectangleList2.Add(new Microsoft.Xna.Framework.Rectangle(x1, y, 1, result2.Y - y)); } } } } x1 += num3; } List <Point> pointList1 = new List <Point>(); foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1) { int exitY; if (this.FindSideExit(new Microsoft.Xna.Framework.Rectangle(rectangle.X + rectangle.Width, rectangle.Y + 1, 1, rectangle.Height - 2), false, out exitY)) { pointList1.Add(new Point(rectangle.X + rectangle.Width - 1, exitY)); } if (this.FindSideExit(new Microsoft.Xna.Framework.Rectangle(rectangle.X, rectangle.Y + 1, 1, rectangle.Height - 2), true, out exitY)) { pointList1.Add(new Point(rectangle.X, exitY)); } } List <Tuple <Point, Point> > tupleList2 = new List <Tuple <Point, Point> >(); for (int index2 = 1; index2 < rectangleList1.Count; ++index2) { Microsoft.Xna.Framework.Rectangle rectangle1 = rectangleList1[index2]; Microsoft.Xna.Framework.Rectangle rectangle2 = rectangleList1[index2 - 1]; if (rectangle2.X - rectangle1.X > rectangle1.X + rectangle1.Width - (rectangle2.X + rectangle2.Width)) { tupleList2.Add(new Tuple <Point, Point>(new Point(rectangle1.X + rectangle1.Width - 1, rectangle1.Y + 1), new Point(rectangle1.X + rectangle1.Width - rectangle1.Height + 1, rectangle1.Y + rectangle1.Height - 1))); } else { tupleList2.Add(new Tuple <Point, Point>(new Point(rectangle1.X, rectangle1.Y + 1), new Point(rectangle1.X + rectangle1.Height - 1, rectangle1.Y + rectangle1.Height - 1))); } } List <Point> pointList2 = new List <Point>(); int exitX; if (this.FindVerticalExit(new Microsoft.Xna.Framework.Rectangle(room2.X + 2, room2.Y, room2.Width - 4, 1), true, out exitX)) { pointList2.Add(new Point(exitX, room2.Y)); } if (this.FindVerticalExit(new Microsoft.Xna.Framework.Rectangle(room3.X + 2, room3.Y + room3.Height - 1, room3.Width - 4, 1), false, out exitX)) { pointList2.Add(new Point(exitX, room3.Y + room3.Height - 1)); } foreach (Microsoft.Xna.Framework.Rectangle area in rectangleList1) { WorldUtils.Gen(new Point(area.X, area.Y), (GenShape) new Shapes.Rectangle(area.Width, area.Height), Actions.Chain((GenAction) new Actions.SetTile(buildData.Tile, false, true), (GenAction) new Actions.SetFrames(true))); WorldUtils.Gen(new Point(area.X + 1, area.Y + 1), (GenShape) new Shapes.Rectangle(area.Width - 2, area.Height - 2), Actions.Chain((GenAction) new Actions.ClearTile(true), (GenAction) new Actions.PlaceWall(buildData.Wall, true))); structures.AddStructure(area, 8); } foreach (Tuple <Point, Point> tuple in tupleList2) { Point origin1 = tuple.Item1; Point point = tuple.Item2; int num4 = point.X > origin1.X ? 1 : -1; ShapeData data = new ShapeData(); for (int y = 0; y < point.Y - origin1.Y; ++y) { data.Add(num4 * (y + 1), y); } WorldUtils.Gen(origin1, (GenShape) new ModShapes.All(data), Actions.Chain((GenAction) new Actions.PlaceTile((ushort)19, buildData.PlatformStyle), (GenAction) new Actions.SetSlope(num4 == 1 ? 1 : 2), (GenAction) new Actions.SetFrames(true))); WorldUtils.Gen(new Point(origin1.X + (num4 == 1 ? 1 : -4), origin1.Y - 1), (GenShape) new Shapes.Rectangle(4, 1), Actions.Chain((GenAction) new Actions.Clear(), (GenAction) new Actions.PlaceWall(buildData.Wall, true), (GenAction) new Actions.PlaceTile((ushort)19, buildData.PlatformStyle), (GenAction) new Actions.SetFrames(true))); } foreach (Point origin1 in pointList1) { WorldUtils.Gen(origin1, (GenShape) new Shapes.Rectangle(1, 3), (GenAction) new Actions.ClearTile(true)); WorldGen.PlaceTile(origin1.X, origin1.Y, 10, true, true, -1, buildData.DoorStyle); } foreach (Point origin1 in pointList2) { Shapes.Rectangle rectangle = new Shapes.Rectangle(3, 1); GenAction action = Actions.Chain((GenAction) new Actions.ClearMetadata(), (GenAction) new Actions.PlaceTile((ushort)19, buildData.PlatformStyle), (GenAction) new Actions.SetFrames(true)); WorldUtils.Gen(origin1, (GenShape)rectangle, action); } foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList2) { if (rectangle.Height > 1 && (int)GenBase._tiles[rectangle.X, rectangle.Y - 1].type != 19) { WorldUtils.Gen(new Point(rectangle.X, rectangle.Y), (GenShape) new Shapes.Rectangle(rectangle.Width, rectangle.Height), Actions.Chain((GenAction) new Actions.SetTile((ushort)124, false, true), (GenAction) new Actions.SetFrames(true))); Tile tile = GenBase._tiles[rectangle.X, rectangle.Y + rectangle.Height]; int num4 = 0; tile.slope((byte)num4); int num5 = 0; tile.halfBrick(num5 != 0); } } Point[] pointArray = new Point[7] { new Point(14, buildData.TableStyle), new Point(16, 0), new Point(18, buildData.WorkbenchStyle), new Point(86, 0), new Point(87, buildData.PianoStyle), new Point(94, 0), new Point(101, buildData.BookcaseStyle) }; foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1) { int num4 = rectangle.Width / 8; int num5 = rectangle.Width / (num4 + 1); int num6 = GenBase._random.Next(2); for (int index2 = 0; index2 < num4; ++index2) { int num7 = (index2 + 1) * num5 + rectangle.X; switch (index2 + num6 % 2) { case 0: int num8 = rectangle.Y + Math.Min(rectangle.Height / 2, rectangle.Height - 5); Vector2 vector2 = WorldGen.randHousePicture(); int x2 = (int)vector2.X; int y = (int)vector2.Y; if (!WorldGen.nearPicture(num7, num8)) { WorldGen.PlaceTile(num7, num8, x2, true, false, -1, y); break; } break; case 1: int j = rectangle.Y + 1; WorldGen.PlaceTile(num7, j, 34, true, false, -1, GenBase._random.Next(6)); for (int index3 = -1; index3 < 2; ++index3) { for (int index4 = 0; index4 < 3; ++index4) { GenBase._tiles[index3 + num7, index4 + j].frameX += (short)54; } } break; } } int num9 = rectangle.Width / 8 + 3; WorldGen.SetupStatueList(); for (; num9 > 0; --num9) { int num7 = GenBase._random.Next(rectangle.Width - 3) + 1 + rectangle.X; int num8 = rectangle.Y + rectangle.Height - 2; switch (GenBase._random.Next(4)) { case 0: WorldGen.PlaceSmallPile(num7, num8, GenBase._random.Next(31, 34), 1, (ushort)185); break; case 1: WorldGen.PlaceTile(num7, num8, 186, true, false, -1, GenBase._random.Next(22, 26)); break; case 2: int index2 = GenBase._random.Next(2, WorldGen.statueList.Length); WorldGen.PlaceTile(num7, num8, (int)WorldGen.statueList[index2].X, true, false, -1, (int)WorldGen.statueList[index2].Y); if (WorldGen.StatuesWithTraps.Contains(index2)) { WorldGen.PlaceStatueTrap(num7, num8); break; } break; case 3: Point point = Utils.SelectRandom <Point>(GenBase._random, pointArray); WorldGen.PlaceTile(num7, num8, point.X, true, false, -1, point.Y); break; } } } foreach (Microsoft.Xna.Framework.Rectangle room4 in rectangleList1) { buildData.ProcessRoom(room4); } bool flag1 = false; foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1) { int j = rectangle.Height - 1 + rectangle.Y; int Style = j > (int)Main.worldSurface ? buildData.ChestStyle : 0; int num4 = 0; while (num4 < 10 && !(flag1 = WorldGen.AddBuriedChest(GenBase._random.Next(2, rectangle.Width - 2) + rectangle.X, j, 0, false, Style))) { ++num4; } if (!flag1) { int i = rectangle.X + 2; while (i <= rectangle.X + rectangle.Width - 2 && !(flag1 = WorldGen.AddBuriedChest(i, j, 0, false, Style))) { ++i; } if (flag1) { break; } } else { break; } } if (!flag1) { foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1) { int j = rectangle.Y - 1; int Style = j > (int)Main.worldSurface ? buildData.ChestStyle : 0; int num4 = 0; while (num4 < 10 && !(flag1 = WorldGen.AddBuriedChest(GenBase._random.Next(2, rectangle.Width - 2) + rectangle.X, j, 0, false, Style))) { ++num4; } if (!flag1) { int i = rectangle.X + 2; while (i <= rectangle.X + rectangle.Width - 2 && !(flag1 = WorldGen.AddBuriedChest(i, j, 0, false, Style))) { ++i; } if (flag1) { break; } } else { break; } } } if (!flag1) { for (int index2 = 0; index2 < 1000; ++index2) { int i = GenBase._random.Next(rectangleList1[0].X - 30, rectangleList1[0].X + 30); int num4 = GenBase._random.Next(rectangleList1[0].Y - 30, rectangleList1[0].Y + 30); int num5 = num4 > (int)Main.worldSurface ? buildData.ChestStyle : 0; int j = num4; int contain = 0; int num6 = 0; int Style = num5; if (WorldGen.AddBuriedChest(i, j, contain, num6 != 0, Style)) { break; } } } if (buildData == CaveHouseBiome.BuildData.Jungle && this._sharpenerCount < GenBase._random.Next(2, 5)) { bool flag2 = false; foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1) { int j = rectangle.Height - 2 + rectangle.Y; for (int index2 = 0; index2 < 10; ++index2) { int i = GenBase._random.Next(2, rectangle.Width - 2) + rectangle.X; WorldGen.PlaceTile(i, j, 377, true, true, -1, 0); if (flag2 = GenBase._tiles[i, j].active() && (int)GenBase._tiles[i, j].type == 377) { break; } } if (!flag2) { int i = rectangle.X + 2; while (i <= rectangle.X + rectangle.Width - 2 && !(flag2 = WorldGen.PlaceTile(i, j, 377, true, true, -1, 0))) { ++i; } if (flag2) { break; } } else { break; } } if (flag2) { this._sharpenerCount = this._sharpenerCount + 1; } } if (buildData == CaveHouseBiome.BuildData.Desert && this._extractinatorCount < GenBase._random.Next(2, 5)) { bool flag2 = false; foreach (Microsoft.Xna.Framework.Rectangle rectangle in rectangleList1) { int j = rectangle.Height - 2 + rectangle.Y; for (int index2 = 0; index2 < 10; ++index2) { int i = GenBase._random.Next(2, rectangle.Width - 2) + rectangle.X; WorldGen.PlaceTile(i, j, 219, true, true, -1, 0); if (flag2 = GenBase._tiles[i, j].active() && (int)GenBase._tiles[i, j].type == 219) { break; } } if (!flag2) { int i = rectangle.X + 2; while (i <= rectangle.X + rectangle.Width - 2 && !(flag2 = WorldGen.PlaceTile(i, j, 219, true, true, -1, 0))) { ++i; } if (flag2) { break; } } else { break; } } if (flag2) { this._extractinatorCount = this._extractinatorCount + 1; } } 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); }