void Apply() { switch (mode) { case 0: { GenRunners.VeinRunner( i: (int)p.Dequeue(), j: (int)p.Dequeue(), strength: (double)p.Dequeue(), speed: (Vector2)p.Dequeue(), length: (double)p.Dequeue(), twist: (float)p.Dequeue(), randomtwist: (bool)p.Dequeue()); break; } case 1: { int i = (int)p.Dequeue(); int j = (int)p.Dequeue(); double strength = (double)p.Dequeue(); Vector2 speed = (Vector2)p.Dequeue(); Stack <((Vector2, Vector2), byte)> veins = new Stack <((Vector2, Vector2), byte)>(); double length = (double)p.Dequeue(); float twist = (float)p.Dequeue(); bool twistRand = (bool)p.Dequeue(); veins.Push(((new Vector2(i, j), speed), (p.Count > 0 ? (byte)p.Dequeue() : (byte)10))); ((Vector2 p, Vector2 v)v, byte count)curr; (Vector2 p, Vector2 v)ret; byte count; while (veins.Count > 0) { curr = veins.Pop(); count = curr.count; ret = GenRunners.VeinRunner( i: (int)curr.v.p.X, j: (int)curr.v.p.Y, strength: strength, speed: curr.v.v, length: length, twist: twist, randomtwist: twistRand); if (count > 0 && Main.rand.Next(3) == 0) { veins.Push(((ret.p, ret.v.RotatedBy(Main.rand.NextBool() ? -1 : 1)), (byte)Main.rand.Next(--count))); } if (count > 0) { veins.Push(((ret.p, ret.v.RotatedByRandom(0.05)), --count)); } } break; } case 2: World.BiomeData.RivenHive.Gen.StartHive((int)p.Dequeue(), (int)p.Dequeue()); break; case 3: World.BiomeData.RivenHive.Gen.HiveCave((int)p.Dequeue(), (int)p.Dequeue()); break; case 4: World.BiomeData.BrinePool.Gen.BrineStart((int)p.Dequeue(), (int)p.Dequeue()); break; case 5: World.BiomeData.DefiledWastelands.Gen.StartDefiled((int)p.Dequeue(), (int)p.Dequeue()); break; case 6: { Vector2 a = new Vector2((float)p.Dequeue(), (float)p.Dequeue()); World.BiomeData.DefiledWastelands.Gen.DefiledRibs((int)a.X, (int)a.Y); for (int i = (int)a.X - 1; i < (int)a.X + 3; i++) { for (int j = (int)a.Y - 2; j < (int)a.Y + 2; j++) { Main.tile[i, j].active(false); } } TileObject.CanPlace((int)a.X, (int)a.Y, (ushort)ModContent.TileType <Tiles.Defiled.Defiled_Heart>(), 0, 1, out var data); TileObject.Place(data); break; } } }
public static void StartHive(int i, int j) { const float strength = 2.4f; const float wallThickness = 4f; ushort fleshID = (ushort)ModContent.TileType <Riven_Flesh>(); ushort weakFleshID = (ushort)ModContent.TileType <Weak_Riven_Flesh>(); ushort fleshWallID = (ushort)ModContent.WallType <Riven_Flesh_Wall>(); lesionCount = 0; int j2 = j; if (j2 > Main.worldSurface) { j2 = (int)Main.worldSurface; } for (; !SolidTile(i, j2); j2++) { } Vector2 position = new Vector2(i, j2); for (int x = i - 30; x < i + 30; x++) { for (int y = j2 - 25; y < j2 + 15; y++) { float diff = (((y - j2) * (y - j2) * 1.5f) + (x - i) * (x - i)); if (diff > 800) { continue; } Main.tile[x, y].ResetToType(fleshID); if (diff < 750) { Main.tile[x, y].wall = fleshWallID; } } } Vector2 vector = new Vector2(0, -1).RotatedByRandom(1.6f, genRand); int distance = 0; while (Main.tile[(int)position.X, (int)position.Y].active() && Main.tileSolid[Main.tile[(int)position.X, (int)position.Y].type]) { //Main.tile[(int)position.X, (int)position.Y].ResetToType(TileID.EmeraldGemspark); //SquareTileFrame((int)position.X, (int)position.Y); position += vector; if (++distance >= 160) { break; } } vector = -vector; (Vector2 position, Vector2 velocity)last = (position, vector); //Tile t = Main.tile[(int)last.position.X, (int)last.position.Y]; (int x, int y, Vector2 direction, double length)startValues = ((int)last.position.X, (int)last.position.Y, last.velocity.RotatedByRandom(0.5f, genRand), distance *genRand.NextFloat(0.4f, 0.6f)); last = GenRunners.WalledVeinRunner(startValues.x, startValues.y, strength * genRand.NextFloat(0.9f, 1.1f), startValues.direction, startValues.length, weakFleshID, wallThickness); //t.ResetToType(TileID.AmethystGemspark); Vector2 manualVel = new Vector2(last.velocity.X, 0.2f); //t = Main.tile[(int)last.position.X, (int)last.position.Y]; GenRunners.WalledVeinRunner((int)last.position.X, (int)last.position.Y, strength * genRand.NextFloat(0.9f, 1.1f), Vector2.Normalize(new Vector2(-manualVel.X, 0.2f)), genRand.NextFloat(distance * 0.4f, distance * 0.6f) * (Math.Abs(manualVel.X) + 0.5f), weakFleshID, wallThickness, wallType: fleshWallID); last = GenRunners.WalledVeinRunner((int)last.position.X, (int)last.position.Y, strength * genRand.NextFloat(0.9f, 1.1f), Vector2.Normalize(manualVel), genRand.NextFloat(distance * 0.4f, distance * 0.6f) / (Math.Abs(manualVel.X) + 0.5f), weakFleshID, wallThickness, wallType: fleshWallID); GenRunners.WalledVeinRunner((int)last.position.X, (int)last.position.Y, strength * genRand.NextFloat(0.9f, 1.1f), Vector2.Normalize(manualVel), genRand.NextFloat(distance * 0.4f, distance * 0.6f) / (Math.Abs(manualVel.X) + 0.5f), weakFleshID, wallThickness, wallType: fleshWallID); last = GenRunners.WalledVeinRunner((int)last.position.X, (int)last.position.Y, strength * genRand.NextFloat(0.9f, 1.1f), new Vector2(0, 1).RotatedByRandom(0.2f, genRand), genRand.NextFloat(distance * 0.4f, distance * 0.6f), weakFleshID, wallThickness, wallType: fleshWallID); //t.ResetToType(TileID.AmethystGemspark); manualVel.X = -manualVel.X; //t = Main.tile[(int)last.position.X, (int)last.position.Y]; GenRunners.WalledVeinRunner((int)last.position.X, (int)last.position.Y, strength * genRand.NextFloat(0.9f, 1.1f), Vector2.Normalize(new Vector2(-manualVel.X, 0.2f)), genRand.NextFloat(distance * 0.4f, distance * 0.6f) * (Math.Abs(manualVel.X) + 0.5f), weakFleshID, wallThickness, wallType: fleshWallID); last = GenRunners.WalledVeinRunner((int)last.position.X, (int)last.position.Y, strength * genRand.NextFloat(0.9f, 1.1f), Vector2.Normalize(manualVel), genRand.NextFloat(distance * 0.4f, distance * 0.6f) / (Math.Abs(manualVel.X) + 0.5f), weakFleshID, wallThickness, wallType: fleshWallID); GenRunners.WalledVeinRunner((int)last.position.X, (int)last.position.Y, strength * genRand.NextFloat(0.9f, 1.1f), Vector2.Normalize(manualVel), genRand.NextFloat(distance * 0.4f, distance * 0.6f) / (Math.Abs(manualVel.X) + 0.5f), weakFleshID, wallThickness, wallType: fleshWallID); last = GenRunners.WalledVeinRunner((int)last.position.X, (int)last.position.Y, strength * genRand.NextFloat(0.9f, 1.1f), new Vector2(0, 1).RotatedByRandom(0.2f, genRand), genRand.NextFloat(distance * 0.4f, distance * 0.6f), weakFleshID, wallThickness, wallType: fleshWallID); //t.ResetToType(TileID.AmethystGemspark); for (int index = 0; index < 10; index++) { //t = Main.tile[(int)last.position.X, (int)last.position.Y]; last = GenRunners.WalledVeinRunner((int)last.position.X, (int)last.position.Y, strength * genRand.NextFloat(0.9f, 1.1f), last.velocity.RotatedByRandom(0.8f, genRand), genRand.NextFloat(distance * 0.2f, distance * 0.3f), weakFleshID, wallThickness, wallType: fleshWallID); if (index < 8) { GenRunners.WalledVeinRunner((int)last.position.X, (int)last.position.Y, strength * genRand.NextFloat(0.9f, 1.1f), last.velocity.RotatedBy(genRand.Next(2) * 2 - 1).RotatedByRandom(0.8f, genRand), genRand.NextFloat(distance * 0.4f, distance * 0.6f), weakFleshID, wallThickness, wallType: fleshWallID); } PolarVec2 vel = new PolarVec2(1, last.velocity.ToRotation()); OriginExtensions.AngularSmoothing(ref vel.Theta, MathHelper.PiOver2, 0.7f); //t.ResetToType(TileID.AmethystGemspark); last = (last.position, (Vector2)vel); } //t = Main.tile[(int)last.position.X, (int)last.position.Y]; //t.ResetToType(TileID.AmethystGemspark); Point caveCenter = HiveCave((int)last.position.X, (int)last.position.Y); Vector2 cavernOpening = last.position - caveCenter.ToVector2(); GenRunners.VeinRunner((int)last.position.X, (int)last.position.Y, strength, cavernOpening.SafeNormalize(Vector2.Zero), cavernOpening.Length()); GenRunners.VeinRunner(startValues.x, startValues.y, strength, startValues.direction, startValues.length); (Vector2 position, Vector2 velocity)[] arms = new (Vector2 position, Vector2 velocity)[4];