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

◆ CanKillTile() [2/3]

static bool Terraria.WorldGen.CanKillTile ( int i,
int j,
out bool blockDamaged )
inlinestatic

Definition at line 52915 of file WorldGen.cs.

52916 {
52917 blockDamaged = false;
52918 if (i < 0 || j < 0 || i >= Main.maxTilesX || j >= Main.maxTilesY)
52919 {
52920 return false;
52921 }
52922 Tile tile = Main.tile[i, j];
52923 Tile tile2 = null;
52924 if (tile == null)
52925 {
52926 return false;
52927 }
52928 if (!tile.active())
52929 {
52930 return false;
52931 }
52932 if (j >= 1)
52933 {
52934 tile2 = Main.tile[i, j - 1];
52935 }
52936 if (tile2 != null && tile2.active())
52937 {
52938 int type = tile2.type;
52939 if (TileID.Sets.IsATreeTrunk[type] && tile.type != type && (tile2.frameX != 66 || tile2.frameY < 0 || tile2.frameY > 44) && (tile2.frameX != 88 || tile2.frameY < 66 || tile2.frameY > 110) && tile2.frameY < 198)
52940 {
52941 return false;
52942 }
52943 switch (type)
52944 {
52945 case 323:
52946 if (tile.type != type && (tile2.frameX == 66 || tile2.frameX == 220))
52947 {
52948 return false;
52949 }
52950 break;
52951 case 21:
52952 case 26:
52953 case 72:
52954 case 77:
52955 case 88:
52956 case 467:
52957 case 488:
52958 if (tile.type != type)
52959 {
52960 return false;
52961 }
52962 break;
52963 case 80:
52964 if (tile.type != type)
52965 {
52966 int num = tile2.frameX / 18;
52967 if ((uint)num <= 1u || (uint)(num - 4) <= 1u)
52968 {
52969 return false;
52970 }
52971 }
52972 break;
52973 }
52974 }
52975 if (TileID.Sets.Boulders[tile.type] && CheckBoulderChest(i, j))
52976 {
52977 blockDamaged = true;
52978 return false;
52979 }
52980 switch (tile.type)
52981 {
52982 case 10:
52983 if (IsLockedDoor(tile))
52984 {
52985 blockDamaged = true;
52986 return false;
52987 }
52988 break;
52989 case 235:
52990 {
52991 int num2 = i - tile.frameX % 54 / 18;
52992 for (int k = 0; k < 3; k++)
52993 {
52994 Tile tile3 = Main.tile[num2 + k, j - 1];
52995 if (tile3.active() && IsAContainer(tile3))
52996 {
52997 blockDamaged = true;
52998 return false;
52999 }
53000 }
53001 break;
53002 }
53003 case 21:
53004 case 467:
53005 if (!Chest.CanDestroyChest(i - tile.frameX / 18 % 2, j - tile.frameY / 18))
53006 {
53007 return false;
53008 }
53009 break;
53010 case 88:
53011 if (!Chest.CanDestroyChest(i - tile.frameX / 18 % 3, j - tile.frameY / 18))
53012 {
53013 return false;
53014 }
53015 break;
53016 }
53017 return true;
53018 }
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.Tile.active(), Terraria.ID.TileID.Sets.Boulders, Terraria.Chest.CanDestroyChest(), Terraria.Tile.frameX, Terraria.Tile.frameY, Terraria.ID.TileID.Sets.IsATreeTrunk, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.tile, System.type, and Terraria.Tile.type.