TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ PlacePumpkin()

static void Terraria.WorldGen.PlacePumpkin ( int x,
int superY )
inlinestatic

Definition at line 46492 of file WorldGen.cs.

46493 {
46494 ushort type = 254;
46495 int num = genRand.Next(6) * 36;
46496 if (x < 5 || x > Main.maxTilesX - 5 || superY < 5 || superY > Main.maxTilesY - 5)
46497 {
46498 return;
46499 }
46500 bool flag = true;
46501 for (int i = x - 1; i < x + 1; i++)
46502 {
46503 for (int j = superY - 1; j < superY + 1; j++)
46504 {
46505 if (Main.tile[i, j] == null)
46506 {
46507 Main.tile[i, j] = default(Tile);
46508 }
46509 if (Main.tile[i, j].active() && Main.tile[i, j].type != 3 && Main.tile[i, j].type != 73 && Main.tile[i, j].type != 113 && Main.tile[i, j].type != 110 && (Main.tile[i, j].type != 185 || Main.tile[i, j].frameY != 0))
46510 {
46511 flag = false;
46512 }
46513 if (Main.tile[i, j].liquid > 0)
46514 {
46515 flag = false;
46516 }
46517 }
46518 if (!SolidTile(i, superY + 1) || (Main.tile[i, superY + 1].type != 2 && Main.tile[i, superY + 1].type != 109))
46519 {
46520 flag = false;
46521 }
46522 }
46523 if (flag)
46524 {
46525 Main.tile[x - 1, superY - 1].active(active: true);
46526 Main.tile[x - 1, superY - 1].frameY = (short)num;
46527 Main.tile[x - 1, superY - 1].frameX = 0;
46528 Main.tile[x - 1, superY - 1].type = type;
46529 Main.tile[x, superY - 1].active(active: true);
46530 Main.tile[x, superY - 1].frameY = (short)num;
46531 Main.tile[x, superY - 1].frameX = 18;
46532 Main.tile[x, superY - 1].type = type;
46533 Main.tile[x - 1, superY].active(active: true);
46534 Main.tile[x - 1, superY].frameY = (short)(num + 18);
46535 Main.tile[x - 1, superY].frameX = 0;
46536 Main.tile[x - 1, superY].type = type;
46537 Main.tile[x, superY].active(active: true);
46538 Main.tile[x, superY].frameY = (short)(num + 18);
46539 Main.tile[x, superY].frameX = 18;
46540 Main.tile[x, superY].type = type;
46541 }
46542 }
static UnifiedRandom genRand
Definition WorldGen.cs:1455

References Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Enums.SolidTile, and Terraria.Main.tile.