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

◆ AnchorValid()

static bool Terraria.WorldGen.AnchorValid ( Tile tileCache,
AnchorType anchor )
inlinestatic

Definition at line 43383 of file WorldGen.cs.

43384 {
43385 bool flag = false;
43386 if (tileCache.nactive())
43387 {
43388 if ((anchor & AnchorType.SolidTile) == AnchorType.SolidTile && Main.tileSolid[tileCache.type] && !Main.tileSolidTop[tileCache.type] && !Main.tileNoAttach[tileCache.type] && tileCache.blockType() == 0)
43389 {
43390 flag = true;
43391 }
43392 if ((anchor & AnchorType.SolidBottom) == AnchorType.SolidBottom && ((Main.tileSolid[tileCache.type] && (!Main.tileSolidTop[tileCache.type] || (TileID.Sets.Platforms[tileCache.type] && (tileCache.halfBrick() || tileCache.topSlope())))) || tileCache.topSlope() || tileCache.halfBrick()) && !TileID.Sets.NotReallySolid[tileCache.type] && !tileCache.bottomSlope())
43393 {
43394 flag = true;
43395 }
43396 if (!flag && ((anchor & AnchorType.SolidWithTop) == AnchorType.SolidWithTop || (anchor & AnchorType.Table) == AnchorType.Table))
43397 {
43398 if (TileID.Sets.Platforms[tileCache.type])
43399 {
43400 int num = tileCache.frameX / TileObjectData.PlatformFrameWidth();
43401 if ((!tileCache.halfBrick() && num >= 0 && num <= 7) || (num >= 12 && num <= 16) || (num >= 25 && num <= 26))
43402 {
43403 flag = true;
43404 }
43405 }
43406 else if (Main.tileSolid[tileCache.type] && Main.tileSolidTop[tileCache.type])
43407 {
43408 flag = true;
43409 }
43410 }
43411 if (!flag && (anchor & AnchorType.Table) == AnchorType.Table && !TileID.Sets.Platforms[tileCache.type] && Main.tileTable[tileCache.type] && tileCache.blockType() == 0)
43412 {
43413 flag = true;
43414 }
43415 if (!flag && (anchor & AnchorType.SolidSide) == AnchorType.SolidSide && Main.tileSolid[tileCache.type] && !Main.tileSolidTop[tileCache.type])
43416 {
43417 int num2 = tileCache.blockType();
43418 if ((uint)(num2 - 4) <= 1u)
43419 {
43420 flag = true;
43421 }
43422 }
43423 }
43424 else if (!flag && (anchor & AnchorType.EmptyTile) == AnchorType.EmptyTile)
43425 {
43426 flag = true;
43427 }
43428 return flag;
43429 }
static bool[] NotReallySolid
Definition TileID.cs:257
static bool[] Platforms
Definition TileID.cs:163

References Terraria.Tile.blockType(), Terraria.Tile.bottomSlope(), Terraria.Tile.halfBrick(), Terraria.Tile.nactive(), Terraria.ID.TileID.Sets.NotReallySolid, Terraria.ObjectData.TileObjectData.PlatformFrameWidth(), Terraria.ID.TileID.Sets.Platforms, Terraria.Main.tileNoAttach, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, Terraria.Main.tileTable, Terraria.Tile.topSlope(), and Terraria.Tile.type.