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

◆ Step_PumpkinSeeds()

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

Definition at line 1004 of file SmartCursorHelper.cs.

1005 {
1006 if (providedInfo.item.createTile != 254 || focusedX != -1 || focusedY != -1)
1007 {
1008 return;
1009 }
1010 _targets.Clear();
1011 for (int i = providedInfo.reachableStartX; i <= providedInfo.reachableEndX; i++)
1012 {
1013 for (int j = providedInfo.reachableStartY; j <= providedInfo.reachableEndY; j++)
1014 {
1015 Tile tile = Main.tile[i, j + 1];
1016 Tile tile2 = Main.tile[i + 1, j + 1];
1017 if ((double)j > Main.worldSurface - 2.0)
1018 {
1019 break;
1020 }
1021 bool flag = true;
1022 if (!tile2.active() || !tile.active())
1023 {
1024 flag = false;
1025 }
1026 if (tile2.slope() > 0 || tile.slope() > 0 || tile2.halfBrick() || tile.halfBrick())
1027 {
1028 flag = false;
1029 }
1030 if (tile2.type != 2 && tile2.type != 477 && tile2.type != 109 && tile2.type != 492)
1031 {
1032 flag = false;
1033 }
1034 if (tile.type != 2 && tile.type != 477 && tile.type != 109 && tile.type != 492)
1035 {
1036 flag = false;
1037 }
1038 for (int k = i; k <= i + 1; k++)
1039 {
1040 for (int l = j - 1; l <= j; l++)
1041 {
1042 Tile tile3 = Main.tile[k, l];
1043 if (tile3.active() && (tile3.type < 0 || tile3.type >= TileID.Count || Main.tileSolid[tile3.type] || !WorldGen.CanCutTile(k, l, TileCuttingContext.TilePlacement)))
1044 {
1045 flag = false;
1046 }
1047 }
1048 }
1049 if (flag)
1050 {
1051 _targets.Add(new Tuple<int, int>(i, j));
1052 }
1053 }
1054 }
1055 if (_targets.Count > 0)
1056 {
1057 float num = -1f;
1059 for (int m = 0; m < _targets.Count; m++)
1060 {
1061 float num2 = Vector2.Distance(new Vector2(_targets[m].Item1, _targets[m].Item2) * 16f + Vector2.One * 8f, providedInfo.mouse);
1062 if (num == -1f || num2 < num)
1063 {
1064 num = num2;
1065 tuple = _targets[m];
1066 }
1067 }
1068 if (Collision.InTileBounds(tuple.Item1, tuple.Item2, providedInfo.reachableStartX, providedInfo.reachableStartY, providedInfo.reachableEndX, providedInfo.reachableEndY))
1069 {
1070 focusedX = tuple.Item1;
1071 focusedY = tuple.Item2;
1072 }
1073 }
1074 _targets.Clear();
1075 }
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(), Terraria.WorldGen.CanCutTile(), Microsoft.Xna.Framework.Vector2.Distance(), Terraria.Tile.halfBrick(), Terraria.Collision.InTileBounds(), Terraria.Tile.slope(), Terraria.Main.tile, Terraria.Main.tileSolid, and Terraria.Tile.type.

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