public Subtract ( |
||
shapeData | ||
localOrigin | Point | |
remoteOrigin | Point | |
return | void |
public override bool Place(Point origin, StructureMap structures) { if (WorldGen.SolidTile(origin.X, origin.Y) && GenBase._tiles[origin.X, origin.Y].wall == 3) return false; if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(100), new Conditions.IsSolid()), out origin)) return false; Point result; if (!WorldUtils.Find(new Point(origin.X - 4, origin.Y), Searches.Chain(new Searches.Down(5), new Conditions.IsTile(new ushort[1] { 25 }).AreaAnd(8, 1)), out result)) return false; ShapeData data1 = new ShapeData(); ShapeData shapeData1 = new ShapeData(); ShapeData shapeData2 = new ShapeData(); for (int index = 0; index < 6; ++index) WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(10, 12) + index), Actions.Chain(new Modifiers.Offset(0, 5 * index + 5), new Modifiers.Blotches(3, 0.3).Output(data1))); for (int index = 0; index < 6; ++index) WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(5, 7) + index), Actions.Chain(new Modifiers.Offset(0, 2 * index + 18), new Modifiers.Blotches(3, 0.3).Output(shapeData1))); for (int index = 0; index < 6; ++index) WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(4, 6) + index / 2), Actions.Chain(new Modifiers.Offset(0, (int)(7.5 * (double)index) - 10), new Modifiers.Blotches(3, 0.3).Output(shapeData2))); ShapeData data2 = new ShapeData(shapeData1); shapeData1.Subtract(shapeData2, origin, origin); data2.Subtract(shapeData1, origin, origin); Microsoft.Xna.Framework.Rectangle bounds = ShapeData.GetBounds(origin, data1, shapeData2); if (!structures.CanPlace(bounds, CorruptionPitBiome.ValidTiles, 2)) return false; WorldUtils.Gen(origin, new ModShapes.All(data1), Actions.Chain(new Actions.SetTile((ushort)25, true, true), new Actions.PlaceWall(3, true))); WorldUtils.Gen(origin, new ModShapes.All(shapeData1), new Actions.SetTile(0, true, true)); WorldUtils.Gen(origin, new ModShapes.All(shapeData2), new Actions.ClearTile(true)); WorldUtils.Gen(origin, new ModShapes.All(shapeData1), Actions.Chain(new Modifiers.IsTouchingAir(true), new Modifiers.NotTouching(0 != 0, new ushort[1] { 25 }), new Actions.SetTile(23, true, true))); WorldUtils.Gen(origin, new ModShapes.All(data2), new Actions.PlaceWall(69, true)); structures.AddStructure(bounds, 2); return true; }
public override bool Place(Point origin, StructureMap structures) { Point y; Point point; Dictionary<ushort, int> nums = new Dictionary<ushort, int>(); Point point1 = new Point(origin.X - 25, origin.Y - 25); Shapes.Rectangle rectangle = new Shapes.Rectangle(50, 50); ushort[] numArray = new ushort[] { 0, 1 }; WorldUtils.Gen(point1, rectangle, (new Actions.TileScanner(numArray)).Output(nums)); if (nums[0] + nums[1] < 1250) { return false; } Searches.Up up = new Searches.Up(1000); GenCondition[] genConditionArray = new GenCondition[] { (new Conditions.IsSolid()).AreaOr(1, 50).Not() }; bool flag = WorldUtils.Find(origin, Searches.Chain(up, genConditionArray), out y); Point point2 = origin; Searches.Up up1 = new Searches.Up(origin.Y - y.Y); GenCondition[] isTile = new GenCondition[1]; ushort[] numArray1 = new ushort[] { 53 }; isTile[0] = new Conditions.IsTile(numArray1); if (WorldUtils.Find(point2, Searches.Chain(up1, isTile), out point)) { return false; } if (!flag) { return false; } y.Y = y.Y + 50; ShapeData shapeDatum = new ShapeData(); ShapeData shapeDatum1 = new ShapeData(); Point point3 = new Point(origin.X, origin.Y + 20); Point point4 = new Point(origin.X, origin.Y + 30); float single = 0.8f + GenBase._random.NextFloat() * 0.5f; if (!structures.CanPlace(new Rectangle(point3.X - (int)(20f * single), point3.Y - 20, (int)(40f * single), 40), 0)) { return false; } if (!structures.CanPlace(new Rectangle(origin.X, y.Y + 10, 1, origin.Y - y.Y - 9), 2)) { return false; } Shapes.Slime slime = new Shapes.Slime(20, single, 1f); GenAction[] blotch = new GenAction[] { new Modifiers.Blotches(2, 0.4), (new Actions.ClearTile(true)).Output(shapeDatum) }; WorldUtils.Gen(point3, slime, Actions.Chain(blotch)); Shapes.Mound mound = new Shapes.Mound(14, 14); GenAction[] genActionArray = new GenAction[] { new Modifiers.Blotches(2, 1, 0.8), new Actions.SetTile(0, false, true), (new Actions.SetFrames(true)).Output(shapeDatum1) }; WorldUtils.Gen(point4, mound, Actions.Chain(genActionArray)); shapeDatum.Subtract(shapeDatum1, point3, point4); ModShapes.InnerOutline innerOutline = new ModShapes.InnerOutline(shapeDatum, true); GenAction[] setTile = new GenAction[] { new Actions.SetTile(2, false, true), new Actions.SetFrames(true) }; WorldUtils.Gen(point3, innerOutline, Actions.Chain(setTile)); ModShapes.All all = new ModShapes.All(shapeDatum); GenAction[] rectangleMask = new GenAction[] { new Modifiers.RectangleMask(-40, 40, 0, 40), new Modifiers.IsEmpty(), new Actions.SetLiquid(0, 255) }; WorldUtils.Gen(point3, all, Actions.Chain(rectangleMask)); ModShapes.All all1 = new ModShapes.All(shapeDatum); GenAction[] placeWall = new GenAction[] { new Actions.PlaceWall(68, true), null, null, null }; ushort[] numArray2 = new ushort[] { 2 }; placeWall[1] = new Modifiers.OnlyTiles(numArray2); placeWall[2] = new Modifiers.Offset(0, 1); placeWall[3] = new ActionVines(3, 5, 52); WorldUtils.Gen(point3, all1, Actions.Chain(placeWall)); ShapeData shapeDatum2 = new ShapeData(); Point point5 = new Point(origin.X, y.Y + 10); Shapes.Rectangle rectangle1 = new Shapes.Rectangle(1, origin.Y - y.Y - 9); GenAction[] onlyTile = new GenAction[] { new Modifiers.Blotches(2, 0.2), (new Actions.ClearTile(false)).Output(shapeDatum2), new Modifiers.Expand(1), null, null }; ushort[] numArray3 = new ushort[] { 53 }; onlyTile[3] = new Modifiers.OnlyTiles(numArray3); onlyTile[4] = (new Actions.SetTile(397, false, true)).Output(shapeDatum2); WorldUtils.Gen(point5, rectangle1, Actions.Chain(onlyTile)); WorldUtils.Gen(new Point(origin.X, y.Y + 10), new ModShapes.All(shapeDatum2), new Actions.SetFrames(true)); if (GenBase._random.Next(3) != 0) { WorldGen.PlaceTile(point4.X, point4.Y - 15, 186, true, false, -1, 15); } else { WorldGen.PlaceTile(point4.X, point4.Y - 15, 187, true, false, -1, 17); } ModShapes.All all2 = new ModShapes.All(shapeDatum1); GenAction[] offset = new GenAction[] { new Modifiers.Offset(0, -1), null, null, null }; ushort[] numArray4 = new ushort[] { 2 }; offset[1] = new Modifiers.OnlyTiles(numArray4); offset[2] = new Modifiers.Offset(0, -1); offset[3] = new ActionGrass(); WorldUtils.Gen(point4, all2, Actions.Chain(offset)); structures.AddStructure(new Rectangle(point3.X - (int)(20f * single), point3.Y - 20, (int)(40f * single), 40), 4); return true; }
public override bool Place(Point origin, StructureMap structures) { Point point; if (WorldGen.SolidTile(origin.X, origin.Y) && GenBase._tiles[origin.X, origin.Y].wall == 3) { return false; } Searches.Down down = new Searches.Down(100); GenCondition[] isSolid = new GenCondition[] { new Conditions.IsSolid() }; if (!WorldUtils.Find(origin, Searches.Chain(down, isSolid), out origin)) { return false; } Point point1 = new Point(origin.X - 4, origin.Y); Searches.Down down1 = new Searches.Down(5); GenCondition[] genConditionArray = new GenCondition[1]; ushort[] numArray = new ushort[] { 25 }; genConditionArray[0] = (new Conditions.IsTile(numArray)).AreaAnd(8, 1); if (!WorldUtils.Find(point1, Searches.Chain(down1, genConditionArray), out point)) { return false; } ShapeData shapeDatum = new ShapeData(); ShapeData shapeDatum1 = new ShapeData(); ShapeData shapeDatum2 = new ShapeData(); for (int i = 0; i < 6; i++) { Shapes.Circle circle = new Shapes.Circle(GenBase._random.Next(10, 12) + i); GenAction[] offset = new GenAction[] { new Modifiers.Offset(0, 5 * i + 5), (new Modifiers.Blotches(3, 0.3)).Output(shapeDatum) }; WorldUtils.Gen(origin, circle, Actions.Chain(offset)); } for (int j = 0; j < 6; j++) { Shapes.Circle circle1 = new Shapes.Circle(GenBase._random.Next(5, 7) + j); GenAction[] genActionArray = new GenAction[] { new Modifiers.Offset(0, 2 * j + 18), (new Modifiers.Blotches(3, 0.3)).Output(shapeDatum1) }; WorldUtils.Gen(origin, circle1, Actions.Chain(genActionArray)); } for (int k = 0; k < 6; k++) { Shapes.Circle circle2 = new Shapes.Circle(GenBase._random.Next(4, 6) + k / 2); GenAction[] offset1 = new GenAction[] { new Modifiers.Offset(0, (int)(7.5f * (float)k) - 10), (new Modifiers.Blotches(3, 0.3)).Output(shapeDatum2) }; WorldUtils.Gen(origin, circle2, Actions.Chain(offset1)); } ShapeData shapeDatum3 = new ShapeData(shapeDatum1); shapeDatum1.Subtract(shapeDatum2, origin, origin); shapeDatum3.Subtract(shapeDatum1, origin, origin); ShapeData[] shapeDataArray = new ShapeData[] { shapeDatum, shapeDatum2 }; Rectangle bounds = ShapeData.GetBounds(origin, shapeDataArray); if (!structures.CanPlace(bounds, CorruptionPitBiome.ValidTiles, 2)) { return false; } ModShapes.All all = new ModShapes.All(shapeDatum); GenAction[] setTile = new GenAction[] { new Actions.SetTile(25, true, true), new Actions.PlaceWall(3, true) }; WorldUtils.Gen(origin, all, Actions.Chain(setTile)); WorldUtils.Gen(origin, new ModShapes.All(shapeDatum1), new Actions.SetTile(0, true, true)); WorldUtils.Gen(origin, new ModShapes.All(shapeDatum2), new Actions.ClearTile(true)); ModShapes.All all1 = new ModShapes.All(shapeDatum1); GenAction[] isTouchingAir = new GenAction[] { new Modifiers.IsTouchingAir(true), null, null }; ushort[] numArray1 = new ushort[] { 25 }; isTouchingAir[1] = new Modifiers.NotTouching(false, numArray1); isTouchingAir[2] = new Actions.SetTile(23, true, true); WorldUtils.Gen(origin, all1, Actions.Chain(isTouchingAir)); WorldUtils.Gen(origin, new ModShapes.All(shapeDatum3), new Actions.PlaceWall(69, true)); structures.AddStructure(bounds, 2); return true; }
public override bool Place(Point origin, StructureMap structures) { if (WorldGen.SolidTile(origin.X, origin.Y) && GenBase._tiles[origin.X, origin.Y].wall == 3) { return false; } if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(100), new GenCondition[] { new Conditions.IsSolid() }), out origin)) { return false; } Point point; if (!WorldUtils.Find(new Point(origin.X - 4, origin.Y), Searches.Chain(new Searches.Down(5), new GenCondition[] { new Conditions.IsTile(new ushort[] { 25 }).AreaAnd(8, 1) }), out point)) { return false; } ShapeData shapeData = new ShapeData(); ShapeData shapeData2 = new ShapeData(); ShapeData shapeData3 = new ShapeData(); for (int i = 0; i < 6; i++) { WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(10, 12) + i), Actions.Chain(new GenAction[] { new Modifiers.Offset(0, 5 * i + 5), new Modifiers.Blotches(3, 0.3).Output(shapeData) })); } for (int j = 0; j < 6; j++) { WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(5, 7) + j), Actions.Chain(new GenAction[] { new Modifiers.Offset(0, 2 * j + 18), new Modifiers.Blotches(3, 0.3).Output(shapeData2) })); } for (int k = 0; k < 6; k++) { WorldUtils.Gen(origin, new Shapes.Circle(GenBase._random.Next(4, 6) + k / 2), Actions.Chain(new GenAction[] { new Modifiers.Offset(0, (int)(7.5f * (float)k) - 10), new Modifiers.Blotches(3, 0.3).Output(shapeData3) })); } ShapeData shapeData4 = new ShapeData(shapeData2); shapeData2.Subtract(shapeData3, origin, origin); shapeData4.Subtract(shapeData2, origin, origin); Rectangle bounds = ShapeData.GetBounds(origin, new ShapeData[] { shapeData, shapeData3 }); if (!structures.CanPlace(bounds, CorruptionPitBiome.ValidTiles, 2)) { return false; } WorldUtils.Gen(origin, new ModShapes.All(shapeData), Actions.Chain(new GenAction[] { new Actions.SetTile(25, true, true), new Actions.PlaceWall(3, true) })); WorldUtils.Gen(origin, new ModShapes.All(shapeData2), new Actions.SetTile(0, true, true)); WorldUtils.Gen(origin, new ModShapes.All(shapeData3), new Actions.ClearTile(true)); WorldUtils.Gen(origin, new ModShapes.All(shapeData2), Actions.Chain(new GenAction[] { new Modifiers.IsTouchingAir(true), new Modifiers.NotTouching(false, new ushort[] { 25 }), new Actions.SetTile(23, true, true) })); WorldUtils.Gen(origin, new ModShapes.All(shapeData4), new Actions.PlaceWall(69, true)); structures.AddStructure(bounds, 2); return true; }
public override bool Place(Point origin, StructureMap structures) { Dictionary<ushort, int> dictionary = new Dictionary<ushort, int>(); WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(new ushort[] { 0, 1 }).Output(dictionary)); int num = dictionary[0] + dictionary[1]; if (num < 1250) { return false; } Point point; bool flag = WorldUtils.Find(origin, Searches.Chain(new Searches.Up(1000), new GenCondition[] { new Conditions.IsSolid().AreaOr(1, 50).Not() }), out point); Point point2; bool flag2 = WorldUtils.Find(origin, Searches.Chain(new Searches.Up(origin.Y - point.Y), new GenCondition[] { new Conditions.IsTile(new ushort[] { 53 }) }), out point2); if (flag2) { return false; } if (!flag) { return false; } point.Y += 50; ShapeData shapeData = new ShapeData(); ShapeData shapeData2 = new ShapeData(); Point point3 = new Point(origin.X, origin.Y + 20); Point point4 = new Point(origin.X, origin.Y + 30); float num2 = 0.8f + GenBase._random.NextFloat() * 0.5f; if (!structures.CanPlace(new Rectangle(point3.X - (int)(20f * num2), point3.Y - 20, (int)(40f * num2), 40), 0)) { return false; } if (!structures.CanPlace(new Rectangle(origin.X, point.Y + 10, 1, origin.Y - point.Y - 9), 2)) { return false; } WorldUtils.Gen(point3, new Shapes.Slime(20, num2, 1f), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.4), new Actions.ClearTile(true).Output(shapeData) })); WorldUtils.Gen(point4, new Shapes.Mound(14, 14), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 1, 0.8), new Actions.SetTile(0, false, true), new Actions.SetFrames(true).Output(shapeData2) })); shapeData.Subtract(shapeData2, point3, point4); WorldUtils.Gen(point3, new ModShapes.InnerOutline(shapeData, true), Actions.Chain(new GenAction[] { new Actions.SetTile(2, false, true), new Actions.SetFrames(true) })); WorldUtils.Gen(point3, new ModShapes.All(shapeData), Actions.Chain(new GenAction[] { new Modifiers.RectangleMask(-40, 40, 0, 40), new Modifiers.IsEmpty(), new Actions.SetLiquid(0, 255) })); WorldUtils.Gen(point3, new ModShapes.All(shapeData), Actions.Chain(new GenAction[] { new Actions.PlaceWall(68, true), new Modifiers.OnlyTiles(new ushort[] { 2 }), new Modifiers.Offset(0, 1), new ActionVines(3, 5, 52) })); ShapeData data = new ShapeData(); WorldUtils.Gen(new Point(origin.X, point.Y + 10), new Shapes.Rectangle(1, origin.Y - point.Y - 9), Actions.Chain(new GenAction[] { new Modifiers.Blotches(2, 0.2), new Actions.ClearTile(false).Output(data), new Modifiers.Expand(1), new Modifiers.OnlyTiles(new ushort[] { 53 }), new Actions.SetTile(397, false, true).Output(data) })); WorldUtils.Gen(new Point(origin.X, point.Y + 10), new ModShapes.All(data), new Actions.SetFrames(true)); if (GenBase._random.Next(3) == 0) { WorldGen.PlaceTile(point4.X, point4.Y - 15, 187, true, false, -1, 17); } else { WorldGen.PlaceTile(point4.X, point4.Y - 15, 186, true, false, -1, 15); } WorldUtils.Gen(point4, new ModShapes.All(shapeData2), Actions.Chain(new GenAction[] { new Modifiers.Offset(0, -1), new Modifiers.OnlyTiles(new ushort[] { 2 }), new Modifiers.Offset(0, -1), new ActionGrass() })); structures.AddStructure(new Rectangle(point3.X - (int)(20f * num2), point3.Y - 20, (int)(40f * num2), 40), 4); return true; }