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

◆ FindTreeBranch()

static bool Terraria.NPC.FindTreeBranch ( int landX,
int landY,
out int treeBranchX,
out int treeBranchY )
inlinestatic

Definition at line 90445 of file NPC.cs.

90446 {
90449 if (!WorldGen.InWorld(landX, landY, 11))
90450 {
90451 return false;
90452 }
90453 int num = 1;
90454 for (int i = landX - 10; i <= landX + 10; i++)
90455 {
90456 for (int j = landY - 30; j <= landY + 30; j++)
90457 {
90458 Tile tile = Main.tile[i, j];
90459 if (tile != null && tile.active() && TileID.Sets.IsATreeTrunk[tile.type])
90460 {
90461 int num2 = tile.frameX / 22;
90462 int num3 = tile.frameY / 66;
90463 if (((num2 == 3 && num3 == 0) || (num2 == 3 && num3 == 3) || (num2 == 4 && num3 == 1) || (num2 == 4 && num3 == 3) || (num2 == 2 && num3 == 3)) && Main.rand.Next(num) == 0)
90464 {
90465 treeBranchX = i;
90466 treeBranchY = j;
90467 num++;
90468 }
90469 }
90470 }
90471 }
90472 if (treeBranchX != landX || treeBranchY != landY)
90473 {
90474 return true;
90475 }
90476 return false;
90477 }
static bool[] IsATreeTrunk
If true for a given tile type (P:Terraria.Tile.TileType), then that tile is categorized as a tree tru...
Definition TileID.cs:114

References Terraria.Tile.active(), Terraria.WorldGen.InWorld(), Terraria.ID.TileID.Sets.IsATreeTrunk, Terraria.Main.rand, Terraria.Main.tile, and Terraria.Tile.type.

+ Here is the call graph for this function: