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

◆ Step_PaintRoller()

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

Definition at line 745 of file SmartCursorHelper.cs.

746 {
747 if ((providedInfo.item.type != 1072 && providedInfo.item.type != 1544) || (providedInfo.paintLookup == 0 && providedInfo.paintCoatingLookup == 0) || focusedX != -1 || focusedY != -1)
748 {
749 return;
750 }
751 _targets.Clear();
752 int paintLookup = providedInfo.paintLookup;
753 int paintCoatingLookup = providedInfo.paintCoatingLookup;
754 for (int i = providedInfo.reachableStartX; i <= providedInfo.reachableEndX; i++)
755 {
756 for (int j = providedInfo.reachableStartY; j <= providedInfo.reachableEndY; j++)
757 {
758 Tile tile = Main.tile[i, j];
759 if (tile.wall > 0 && (!tile.active() || !Main.tileSolid[tile.type] || Main.tileSolidTop[tile.type]) && (false | (paintLookup != 0 && tile.wallColor() != paintLookup) | (paintCoatingLookup == 1 && !tile.fullbrightWall()) | (paintCoatingLookup == 2 && !tile.invisibleWall())))
760 {
761 _targets.Add(new Tuple<int, int>(i, j));
762 }
763 }
764 }
765 if (_targets.Count > 0)
766 {
767 float num = -1f;
769 for (int k = 0; k < _targets.Count; k++)
770 {
771 float num2 = Vector2.Distance(new Vector2(_targets[k].Item1, _targets[k].Item2) * 16f + Vector2.One * 8f, providedInfo.mouse);
772 if (num == -1f || num2 < num)
773 {
774 num = num2;
775 tuple = _targets[k];
776 }
777 }
778 if (Collision.InTileBounds(tuple.Item1, tuple.Item2, providedInfo.reachableStartX, providedInfo.reachableStartY, providedInfo.reachableEndX, providedInfo.reachableEndY))
779 {
780 focusedX = tuple.Item1;
781 focusedY = tuple.Item2;
782 }
783 }
784 _targets.Clear();
785 }
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.Tile.fullbrightWall(), Terraria.Collision.InTileBounds(), Terraria.Tile.invisibleWall(), Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, Terraria.Tile.type, Terraria.Tile.wall, and Terraria.Tile.wallColor().

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