public static void Infect(int i, int j) { bool tileSuccess = InfectiousTile.InfectTile(i, j); bool wallSuccess = InfectiousWall.InfectWall(i, j); if (!WorldGen.gen && tileSuccess && wallSuccess) { WorldGen.SquareTileFrame(i, j); if (Main.netMode == NetmodeID.Server) { NetMessage.SendTileSquare(-1, i, j, 3, TileChangeType.None); } } }
private static void GeneratePit(int i, int j) { int basinDepth = ConfigReader.Get <int>("worldgen.mouth.basin depth"); float widthL = 3; float widthR = 3; float inc = 0; void ClearRow() { int left = i - (int)widthL; int right = i + (int)widthR; for (int k = left; k <= right; k++) { WorldGen.KillTile(k, j); if (!InfectiousWall.InfectWall(k, j)) { Framing.GetTileSafely(k, j).wall = (ushort)InfectiousWall.Default; } } } float GetJPercent() => (j - Area.Top) / (float)Area.Height; // Create the opening for (; GetJPercent() < 0.15f && widthL + widthR < Epicenter.SurfaceWidth * 0.8; j++) { inc += 0.07f; widthL += WorldGen.genRand.NextFloat(-inc / 2, inc); widthR += WorldGen.genRand.NextFloat(-inc / 2, inc); ClearRow(); } Rectangle basin = new Rectangle(i - (int)widthL, j, (int)(widthL + widthR), basinDepth); // Create the "stomach" area int oldJ = j; for (; j < oldJ + basinDepth; j++) { widthL += WorldGen.genRand.NextFloat(-1, 1); widthR += WorldGen.genRand.NextFloat(-1, 1); ClearRow(); } for (; widthL + widthR > 0 && inc > 0; j++) { inc -= 0.015f; widthL += WorldGen.genRand.NextFloat(-inc - 1, inc / 2); widthR += WorldGen.genRand.NextFloat(-inc - 1, inc / 2); ClearRow(); } int lowest = WorldgenExtensions.GetLowestInRange(basin.Left, basin.Right, basin.Top, p => WorldGen.SolidOrSlopedTile(p.X, p.Y)); basin.Height = lowest - basin.Top; BiomeManager.Get <Mouth>().Basin = basin; }