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

◆ CheckTrapDoor()

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

Definition at line 43149 of file WorldGen.cs.

43150 {
43151 if (destroyObject)
43152 {
43153 return;
43154 }
43155 bool flag = false;
43156 int num = 0;
43157 int num2 = 0;
43158 Point point = default(Point);
43159 if (type == 387)
43160 {
43161 num = 2;
43162 num2 = 1;
43163 point = GetTopLeftAndStyles(ref x, ref y, num, num2, 18, 18);
43164 flag = flag || !CheckTileFrames(type, x, y, num, num2, point.X, 18, point.Y, 18) || !CheckTileAnchors(x, y, num, num2, 1, AnchorType.SolidTile);
43165 }
43166 if (type == 386)
43167 {
43168 num = 2;
43169 num2 = 2;
43170 point = GetTopLeftAndStyles(ref x, ref y, num, num2, 18, 18);
43171 flag = flag || !CheckTileFrames(type, x, y, num, num2, point.X, 18, point.Y, 18);
43172 if (point.X == 0)
43173 {
43174 flag = flag || !CheckTileAnchors(x, y + 1, num, 1, 1, AnchorType.SolidTile);
43175 }
43176 else if (point.X == 1)
43177 {
43178 flag = flag || !CheckTileAnchors(x, y, num, 1, 1, AnchorType.SolidTile);
43179 }
43180 }
43181 if (!flag)
43182 {
43183 return;
43184 }
43185 destroyObject = true;
43186 for (int i = x; i < x + num; i++)
43187 {
43188 for (int j = y; j < y + num2; j++)
43189 {
43190 KillTile(i, j);
43191 }
43192 }
43193 int type2 = 3239;
43194 if (point.Y == 0)
43195 {
43196 type2 = 3239;
43197 }
43198 Item.NewItem(GetItemSource_FromTileBreak(x, y), x * 16, y * 16, num * 16, num2 * 16, type2);
43199 for (int k = x - 1; k < x + num + 1; k++)
43200 {
43201 for (int l = y - 1; l < y + num2 + 1; l++)
43202 {
43203 TileFrame(k, l);
43204 }
43205 }
43206 destroyObject = false;
43207 }
static bool destroyObject
Definition WorldGen.cs:1020
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static void TileFrame(int i, int j, bool resetFrame=false, bool noBreak=false)
static Point GetTopLeftAndStyles(ref int x, ref int y, int w, int h, int frameXinc, int frameYinc)
static bool CheckTileAnchors(int sx, int sy, int w, int h, int mode, AnchorType anchor)
static bool CheckTileFrames(int type, int sx, int sy, int w, int h, int styleX, int frameXinc, int styleY, int frameYinc)
static IEntitySource GetItemSource_FromTileBreak(int x, int y)

References Terraria.Item.NewItem(), System.type, Microsoft.Xna.Framework.Point.X, and Microsoft.Xna.Framework.Point.Y.