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

◆ Step_Pigronata()

static void Terraria.GameContent.SmartCursorHelper.Step_Pigronata ( SmartCursorUsageInfo providedInfo,
ref int focusedX,
ref int focusedY )
inlinestaticprivate

Definition at line 946 of file SmartCursorHelper.cs.

947 {
948 if (providedInfo.item.createTile != 454 || focusedX != -1 || focusedY != -1)
949 {
950 return;
951 }
952 _targets.Clear();
953 for (int i = providedInfo.reachableStartX; i <= providedInfo.reachableEndX; i++)
954 {
955 for (int j = providedInfo.reachableStartY; j <= providedInfo.reachableEndY && !((double)j > Main.worldSurface - 2.0); j++)
956 {
957 bool flag = true;
958 for (int k = i - 2; k <= i + 1; k++)
959 {
960 for (int l = j - 1; l <= j + 2; l++)
961 {
962 Tile tile = Main.tile[k, l];
963 if (l == j - 1)
964 {
965 if (!WorldGen.SolidTile(tile))
966 {
967 flag = false;
968 }
969 }
970 else if (tile.active() && (!Main.tileCut[tile.type] || tile.type == 454))
971 {
972 flag = false;
973 }
974 }
975 }
976 if (flag)
977 {
978 _targets.Add(new Tuple<int, int>(i, j));
979 }
980 }
981 }
982 if (_targets.Count > 0)
983 {
984 float num = -1f;
986 for (int m = 0; m < _targets.Count; m++)
987 {
988 float num2 = Vector2.Distance(new Vector2(_targets[m].Item1, _targets[m].Item2) * 16f + Vector2.One * 8f, providedInfo.mouse);
989 if (num == -1f || num2 < num)
990 {
991 num = num2;
992 tuple = _targets[m];
993 }
994 }
995 if (Collision.InTileBounds(tuple.Item1, tuple.Item2, providedInfo.reachableStartX, providedInfo.reachableStartY, providedInfo.reachableEndX, providedInfo.reachableEndY))
996 {
997 focusedX = tuple.Item1;
998 focusedY = tuple.Item2;
999 }
1000 }
1001 _targets.Clear();
1002 }
static List< Tuple< int, int > > _targets
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91

References Terraria.GameContent.SmartCursorHelper._targets, Terraria.Tile.active(), Microsoft.Xna.Framework.Vector2.Distance(), Terraria.Collision.InTileBounds(), Terraria.WorldGen.SolidTile(), Terraria.Main.tile, Terraria.Main.tileCut, Terraria.Tile.type, and Terraria.Main.worldSurface.

Referenced by Terraria.GameContent.SmartCursorHelper.SmartCursorLookup().