From 94e2c42b5a0ac64d12878388e2566d513b1d74df Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 31 Jul 2026 18:02:12 -0400 Subject: [PATCH] Fixed the Lizard King painting not generating --- World/CustomTemple.cs | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/World/CustomTemple.cs b/World/CustomTemple.cs index c2ff85acb2..1826053b78 100644 --- a/World/CustomTemple.cs +++ b/World/CustomTemple.cs @@ -921,6 +921,53 @@ namespace CalamityMod.World } } + // Places the "Lizard King" painting + int paintingAmt = Main.maxTilesX > 6400 ? Main.rand.Next(2, 4) : Main.maxTilesX > 4200 ? 2 : 1; + int paintingAttempts = 0; // Give up if all paintings cannot be placed after 10000 attempts + while (paintingAmt > 0 && paintingAttempts <= 10000) + { + paintingAttempts++; + int spotX = WorldGen.genRand.Next(templeLeft, templeRight); + int spotY = WorldGen.genRand.Next(templeTop, templeBottom); + if (Main.tile[spotX, spotY].WallType == WallID.LihzahrdBrickUnsafe && !Main.tile[spotX, spotY].HasTile) + { + bool abortPlacement = false; + for (int i = -70; i <= 70; i++) + { + for (int j = -70; j <= 70; j++) + { + int checkSpotX = spotX + i; + int checkSpotY = spotY + j; + if (!WorldGen.InWorld(checkSpotX, checkSpotY, 5)) + continue; + + Tile tile = Main.tile[checkSpotX, checkSpotY]; + if (tile.HasTile) + { + if (tile.TileType == TileID.Painting3X3) + { + abortPlacement = true; + break; + } + if (i >= -4 && i <= 4 && j >= -4 && j <= 4 && tile.TileType == TileID.LihzahrdBrick) + { + abortPlacement = true; + break; + } + } + } + + if (abortPlacement) + break; + } + if (abortPlacement) + continue; + + if (WorldGen.PlaceTile(spotX, spotY, TileID.Painting3X3, true, false, -1, 88)) + paintingAmt--; + } + } + // Return wood spikes back to normal after the above placements are done. Main.tileSolid[TileID.WoodenSpikes] = true; }