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

◆ Step_PaintScrapper()

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

Definition at line 646 of file SmartCursorHelper.cs.

647 {
648 if (!ItemID.Sets.IsPaintScraper[providedInfo.item.type] || focusedX != -1 || focusedY != -1)
649 {
650 return;
651 }
652 _targets.Clear();
653 for (int i = providedInfo.reachableStartX; i <= providedInfo.reachableEndX; i++)
654 {
655 for (int j = providedInfo.reachableStartY; j <= providedInfo.reachableEndY; j++)
656 {
657 Tile tile = Main.tile[i, j];
658 bool flag = false;
659 if (tile.active())
660 {
661 flag |= tile.color() > 0;
662 flag |= tile.type == 184;
663 flag |= tile.fullbrightBlock();
664 flag |= tile.invisibleBlock();
665 }
666 if (tile.wall > 0)
667 {
668 flag |= tile.wallColor() > 0;
669 flag |= tile.fullbrightWall();
670 flag |= tile.invisibleWall();
671 }
672 if (flag)
673 {
674 _targets.Add(new Tuple<int, int>(i, j));
675 }
676 }
677 }
678 if (_targets.Count > 0)
679 {
680 float num = -1f;
682 for (int k = 0; k < _targets.Count; k++)
683 {
684 float num2 = Vector2.Distance(new Vector2(_targets[k].Item1, _targets[k].Item2) * 16f + Vector2.One * 8f, providedInfo.mouse);
685 if (num == -1f || num2 < num)
686 {
687 num = num2;
688 tuple = _targets[k];
689 }
690 }
691 if (Collision.InTileBounds(tuple.Item1, tuple.Item2, providedInfo.reachableStartX, providedInfo.reachableStartY, providedInfo.reachableEndX, providedInfo.reachableEndY))
692 {
693 focusedX = tuple.Item1;
694 focusedY = tuple.Item2;
695 }
696 }
697 _targets.Clear();
698 }
static List< Tuple< int, int > > _targets
static bool[] IsPaintScraper
Definition ItemID.cs:229
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91

References Terraria.GameContent.SmartCursorHelper._targets, Terraria.Tile.active(), Terraria.Tile.color(), Microsoft.Xna.Framework.Vector2.Distance(), Terraria.Tile.fullbrightBlock(), Terraria.Tile.fullbrightWall(), Terraria.Collision.InTileBounds(), Terraria.Tile.invisibleBlock(), Terraria.Tile.invisibleWall(), Terraria.ID.ItemID.Sets.IsPaintScraper, Terraria.Main.tile, Terraria.Tile.wall, and Terraria.Tile.wallColor().

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