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

◆ CheckSunflower()

static void Terraria.WorldGen.CheckSunflower ( int i,
int j,
int type = 27 )
inlinestatic

Definition at line 45415 of file WorldGen.cs.

45416 {
45417 if (destroyObject)
45418 {
45419 return;
45420 }
45421 bool flag = false;
45422 int num = 0;
45423 int num2 = j;
45424 num += Main.tile[i, j].frameX / 18;
45425 num2 += Main.tile[i, j].frameY / 18 * -1;
45426 while (num > 1)
45427 {
45428 num -= 2;
45429 }
45430 num *= -1;
45431 num += i;
45432 for (int k = num; k < num + 2; k++)
45433 {
45434 for (int l = num2; l < num2 + 4; l++)
45435 {
45436 if (Main.tile[k, l] == null)
45437 {
45438 Main.tile[k, l] = new Tile();
45439 }
45440 int num3;
45441 for (num3 = Main.tile[k, l].frameX / 18; num3 > 1; num3 -= 2)
45442 {
45443 }
45444 if (!Main.tile[k, l].nactive() || Main.tile[k, l].type != type || num3 != k - num || Main.tile[k, l].frameY != (l - num2) * 18)
45445 {
45446 flag = true;
45447 }
45448 }
45449 if (Main.tile[k, num2 + 4] == null)
45450 {
45451 Main.tile[k, num2 + 4] = new Tile();
45452 }
45453 if (!Main.tile[k, num2 + 4].nactive() || (Main.tile[k, num2 + 4].type != 2 && Main.tile[k, num2 + 4].type != 477 && Main.tile[k, num2 + 4].type != 492 && Main.tile[k, num2 + 4].type != 109 && Main.tile[k, num2 + 4].type != 60 && Main.tile[k, num2 + 4].type != 633))
45454 {
45455 flag = true;
45456 }
45457 if (!SolidTile(k, num2 + 4))
45458 {
45459 flag = true;
45460 }
45461 }
45462 if (!flag)
45463 {
45464 return;
45465 }
45466 destroyObject = true;
45467 for (int m = num; m < num + 2; m++)
45468 {
45469 for (int n = num2; n < num2 + 4; n++)
45470 {
45471 if (Main.tile[m, n].type == type && Main.tile[m, n].active())
45472 {
45473 KillTile(m, n);
45474 }
45475 }
45476 }
45477 Item.NewItem(GetItemSource_FromTileBreak(i, j), i * 16, j * 16, 32, 32, 63);
45478 destroyObject = false;
45479 }
static bool destroyObject
Definition WorldGen.cs:1020
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static IEntitySource GetItemSource_FromTileBreak(int x, int y)

References Terraria.Item.NewItem(), Terraria.Enums.SolidTile, Terraria.DataStructures.Tile, Terraria.Main.tile, and System.type.