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

◆ NPCCanStickToWalls()

bool Terraria.NPC.NPCCanStickToWalls ( )
inline

Definition at line 48929 of file NPC.cs.

48930 {
48931 int num = (int)base.Center.X / 16;
48932 int num2 = (int)base.Center.Y / 16;
48933 int num3 = 0;
48934 for (int i = num - 1; i <= num + 1; i++)
48935 {
48936 for (int j = num2 - 1; j <= num2 + 1; j++)
48937 {
48938 Tile tileSafely = Framing.GetTileSafely(i, j);
48939 if ((!tileSafely.active() || !Main.tileSolid[tileSafely.type] || TileID.Sets.Platforms[tileSafely.type]) && tileSafely.wall > 0)
48940 {
48941 num3++;
48942 if (num3 > 4)
48943 {
48944 return true;
48945 }
48946 }
48947 }
48948 }
48949 return false;
48950 }
static bool[] Platforms
Definition TileID.cs:163

References Terraria.Framing.GetTileSafely(), Terraria.ID.TileID.Sets.Platforms, and Terraria.Main.tileSolid.

Referenced by Terraria.NPC.AI(), and Terraria.NPC.AI_003_Fighters().