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

◆ CheckXmasTree()

static void Terraria.WorldGen.CheckXmasTree ( int x,
int y )
inlinestatic

Definition at line 35783 of file WorldGen.cs.

35784 {
35785 if (destroyObject)
35786 {
35787 return;
35788 }
35789 int num = x;
35790 int num2 = y;
35791 if (Main.tile[x, y].frameX < 10)
35792 {
35793 num -= Main.tile[x, y].frameX;
35794 num2 -= Main.tile[x, y].frameY;
35795 }
35796 bool flag = false;
35797 int num3 = 0;
35798 for (int i = num; i < num + 4; i++)
35799 {
35800 int num4 = 0;
35801 for (int j = num2; j < num2 + 8; j++)
35802 {
35803 if (Main.tile[i, j].active() && Main.tile[i, j].type == 171)
35804 {
35805 if (num3 != 0 && num4 != 0 && Main.tile[i, j].frameX != num3 && Main.tile[i, j].frameY != num4)
35806 {
35807 flag = true;
35808 }
35809 }
35810 else
35811 {
35812 flag = true;
35813 }
35814 num4++;
35815 }
35816 num3++;
35817 if (i > num && i < num + 3 && !SolidTile2(i, num2 + 8))
35818 {
35819 flag = true;
35820 }
35821 }
35822 if (!flag)
35823 {
35824 return;
35825 }
35826 destroyObject = true;
35827 bool drop = TileLoader.Drop(x, y, 171);
35828 for (int k = num; k < num + 4; k++)
35829 {
35830 for (int l = num2; l < num2 + 8; l++)
35831 {
35832 if (Main.tile[k, l].type == 171)
35833 {
35834 KillTile(k, l);
35835 }
35836 }
35837 }
35838 using (new Item.DisableNewItemMethod(!drop))
35839 {
35840 Item.NewItem(GetItemSource_FromTileBreak(x, y), x * 16, y * 16, 32, 32, 1873);
35841 destroyObject = false;
35842 }
35843 }
static bool Drop(int i, int j, int type, bool includeLargeObjectDrops=true)
This serves as the central class from which tile-related functions are supported and carried out.
Definition TileLoader.cs:23
static bool destroyObject
Definition WorldGen.cs:1258
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static bool SolidTile2(Tile testTile)
static IEntitySource GetItemSource_FromTileBreak(int x, int y)

References Terraria.ModLoader.TileLoader.Drop(), Terraria.Item.NewItem(), and Terraria.Main.tile.

+ Here is the call graph for this function: