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

◆ CheckTileBreakability()

static int Terraria.WorldGen.CheckTileBreakability ( int x,
int y )
inlinestatic

Definition at line 53065 of file WorldGen.cs.

53066 {
53067 if (Main.tile[x, y] == null)
53068 {
53069 Main.tile[x, y] = new Tile();
53070 }
53071 Tile tile = Main.tile[x, y];
53072 if (y >= 1 && y <= Main.maxTilesY - 1)
53073 {
53074 if (Main.tile[x, y - 1] == null)
53075 {
53076 Main.tile[x, y - 1] = new Tile();
53077 }
53078 if (Main.tile[x, y + 1] == null)
53079 {
53080 Main.tile[x, y + 1] = new Tile();
53081 }
53082 Tile tile2 = Main.tile[x, y - 1];
53083 Tile tile3 = Main.tile[x, y + 1];
53084 if (tile3 != null && tile3.active() && IsLockedDoor(x, y + 1))
53085 {
53086 return 2;
53087 }
53088 if (!Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type])
53089 {
53090 return 0;
53091 }
53092 if (tile2.active())
53093 {
53094 if ((TileID.Sets.PreventsTileRemovalIfOnTopOfIt[tile2.type] && tile.type != tile2.type) | IsLockedDoor(x, y - 1) | (tile2.type == 77 && tile.type != 77 && !Main.hardMode) | (IsAContainer(tile2) && !IsAContainer(tile)))
53095 {
53096 if (TileID.Sets.IsATreeTrunk[tile2.type])
53097 {
53098 if ((tile2.frameX == 66 && tile2.frameY >= 0 && tile2.frameY <= 44) || (tile2.frameX == 88 && tile2.frameY >= 66 && tile2.frameY <= 110) || tile2.frameY >= 198)
53099 {
53100 return 0;
53101 }
53102 return 2;
53103 }
53104 if (tile2.type == 323)
53105 {
53106 if (tile2.frameX == 66 || tile2.frameX == 220)
53107 {
53108 return 2;
53109 }
53110 return 0;
53111 }
53112 return 2;
53113 }
53114 if (tile2.type == 80 && tile2.type != tile.type)
53115 {
53116 int num = tile2.frameX / 18;
53117 if ((uint)num <= 1u || (uint)(num - 4) <= 1u)
53118 {
53119 return 2;
53120 }
53121 }
53122 if (tile.type == 10 && IsLockedDoor(tile))
53123 {
53124 return 1;
53125 }
53126 if (TileID.Sets.Boulders[tile.type])
53127 {
53128 if (CheckBoulderChest(x, y))
53129 {
53130 return 1;
53131 }
53132 return 0;
53133 }
53134 }
53135 if (tile.type == 235)
53136 {
53137 int frameX = tile.frameX;
53138 int num2 = x - frameX % 54 / 18;
53139 for (int i = 0; i < 3; i++)
53140 {
53141 if (Main.tile[num2 + i, y - 1].active() && IsAContainer(Main.tile[num2 + i, y - 1]))
53142 {
53143 return 2;
53144 }
53145 }
53146 }
53147 }
53148 return 0;
53149 }
static bool[] PreventsTileRemovalIfOnTopOfIt
Definition TileID.cs:99
static bool[] Boulders
Definition TileID.cs:123
static bool[] IsATreeTrunk
Definition TileID.cs:91
static bool IsAContainer(Tile t)
static bool IsLockedDoor(int x, int y)
static bool CheckBoulderChest(int i, int j)

References Terraria.ID.TileID.Sets.Boulders, Terraria.Tile.frameX, Terraria.Main.hardMode, Terraria.ID.TileID.Sets.IsATreeTrunk, Terraria.Main.maxTilesY, Terraria.ID.TileID.Sets.PreventsTileRemovalIfOnTopOfIt, Terraria.DataStructures.Tile, Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, and Terraria.Tile.type.

Referenced by Terraria.GameContent.MinecartDiggerHelper.CanGetPastTile().