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

◆ KillTile_GetTreeDrops()

static void Terraria.WorldGen.KillTile_GetTreeDrops ( int i,
int j,
Tile tileCache,
ref bool bonusWood,
ref int dropItem,
ref int secondaryItem )
inlinestaticprivate

Definition at line 56879 of file WorldGen.cs.

56880 {
56881 if (tileCache.frameX >= 22 && tileCache.frameY >= 198)
56882 {
56883 if (Main.netMode != 1)
56884 {
56885 if (genRand.Next(2) == 0)
56886 {
56887 int k;
56888 for (k = j; Main.tile[i, k] != null && (!Main.tile[i, k].active() || !Main.tileSolid[Main.tile[i, k].type] || Main.tileSolidTop[Main.tile[i, k].type]); k++)
56889 {
56890 }
56891 if (Main.tile[i, k] != null)
56892 {
56893 Tile tile = Main.tile[i, k];
56894 if (tile.type == 2 || tile.type == 109 || tile.type == 477 || tile.type == 492 || tile.type == 147 || tile.type == 199 || tile.type == 23 || tile.type == 633)
56895 {
56896 dropItem = 9;
56897 secondaryItem = 27;
56898 }
56899 else
56900 {
56901 dropItem = 9;
56902 }
56903 }
56904 }
56905 else
56906 {
56907 dropItem = 9;
56908 }
56909 }
56910 }
56911 else
56912 {
56913 dropItem = 9;
56914 }
56915 if (dropItem != 9)
56916 {
56917 return;
56918 }
56919 GetTreeBottom(i, j, out var x, out var y);
56920 if (Main.tile[x, y].active())
56921 {
56922 switch (Main.tile[x, y].type)
56923 {
56924 case 633:
56925 dropItem = 5215;
56926 break;
56927 case 23:
56928 case 661:
56929 dropItem = 619;
56930 break;
56931 case 199:
56932 case 662:
56933 dropItem = 911;
56934 break;
56935 case 60:
56936 dropItem = 620;
56937 break;
56938 case 109:
56939 case 492:
56940 dropItem = 621;
56941 break;
56942 case 70:
56943 if (genRand.Next(2) == 0)
56944 {
56945 dropItem = 183;
56946 }
56947 else
56948 {
56949 dropItem = 0;
56950 }
56951 break;
56952 case 147:
56953 dropItem = 2503;
56954 break;
56955 }
56956 }
56957 int num = Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16);
56958 int axe = Main.player[num].inventory[Main.player[num].selectedItem].axe;
56959 if (genRand.Next(100) < axe || Main.rand.Next(3) == 0)
56960 {
56961 bonusWood = true;
56962 }
56963 }
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static void GetTreeBottom(int i, int j, out int x, out int y)

References Terraria.Player.FindClosest(), Terraria.Tile.frameX, Terraria.Tile.frameY, Terraria.Main.netMode, Terraria.Main.player, Terraria.Main.rand, Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, and Terraria.Tile.type.