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

◆ AdjTiles()

void Terraria.Player.AdjTiles ( )
inline

Definition at line 33828 of file Player.cs.

33829 {
33830 int num = 4;
33831 int num2 = 3;
33832 if (ateArtisanBread)
33833 {
33834 num += 4;
33835 num2 += 4;
33836 }
33837 for (int i = 0; i < TileID.Count; i++)
33838 {
33839 oldAdjTile[i] = adjTile[i];
33840 adjTile[i] = false;
33841 }
33843 adjWater = false;
33845 adjHoney = false;
33847 adjLava = false;
33848 alchemyTable = false;
33849 int num3 = (int)((position.X + (float)(width / 2)) / 16f);
33850 int num4 = (int)((position.Y + (float)height) / 16f);
33851 for (int j = num3 - num; j <= num3 + num; j++)
33852 {
33853 for (int k = num4 - num2; k < num4 + num2; k++)
33854 {
33855 if (Main.tile[j, k].active())
33856 {
33857 adjTile[Main.tile[j, k].type] = true;
33858 switch (Main.tile[j, k].type)
33859 {
33860 case 77:
33861 case 302:
33862 adjTile[17] = true;
33863 break;
33864 case 133:
33865 adjTile[17] = true;
33866 adjTile[77] = true;
33867 break;
33868 case 134:
33869 adjTile[16] = true;
33870 break;
33871 case 354:
33872 case 469:
33873 case 487:
33874 adjTile[14] = true;
33875 break;
33876 case 355:
33877 adjTile[13] = true;
33878 adjTile[14] = true;
33879 alchemyTable = true;
33880 break;
33881 }
33882 }
33883 if (Main.tile[j, k].liquid > 200 && Main.tile[j, k].liquidType() == 0)
33884 {
33885 adjWater = true;
33886 }
33887 if (Main.tile[j, k].liquid > 200 && Main.tile[j, k].liquidType() == 2)
33888 {
33889 adjHoney = true;
33890 }
33891 if (Main.tile[j, k].liquid > 200 && Main.tile[j, k].liquidType() == 1)
33892 {
33893 adjLava = true;
33894 }
33895 }
33896 }
33897 if (!Main.playerInventory)
33898 {
33899 return;
33900 }
33901 bool flag = false;
33902 for (int l = 0; l < TileID.Count; l++)
33903 {
33904 if (oldAdjTile[l] != adjTile[l])
33905 {
33906 flag = true;
33907 break;
33908 }
33909 }
33910 if (adjWater != oldAdjWater)
33911 {
33912 flag = true;
33913 }
33914 if (adjHoney != oldAdjHoney)
33915 {
33916 flag = true;
33917 }
33918 if (adjLava != oldAdjLava)
33919 {
33920 flag = true;
33921 }
33922 if (flag)
33923 {
33924 Recipe.FindRecipes();
33925 }
33926 }
Vector2 position
Definition Entity.cs:14
static readonly ushort Count
Definition TileID.cs:1698
bool[] oldAdjTile
Definition Player.cs:2117
bool[] adjTile
Definition Player.cs:2115
bool alchemyTable
Definition Player.cs:589
bool ateArtisanBread
Definition Player.cs:1665

References Terraria.ID.TileID.Count, Terraria.Recipe.FindRecipes(), Terraria.Main.playerInventory, and Terraria.Main.tile.