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

◆ Step_Axe()

static void Terraria.GameContent.SmartCursorHelper.Step_Axe ( SmartCursorUsageInfo providedInfo,
ref int fX,
ref int fY )
inlinestaticprivate

Definition at line 2517 of file SmartCursorHelper.cs.

2518 {
2519 int reachableStartX = providedInfo.reachableStartX;
2520 int reachableStartY = providedInfo.reachableStartY;
2521 int reachableEndX = providedInfo.reachableEndX;
2522 int reachableEndY = providedInfo.reachableEndY;
2523 _ = providedInfo.screenTargetX;
2524 _ = providedInfo.screenTargetY;
2525 if (providedInfo.item.axe <= 0 || fX != -1 || fY != -1)
2526 {
2527 return;
2528 }
2529 float num = -1f;
2530 for (int i = reachableStartX; i <= reachableEndX; i++)
2531 {
2532 for (int j = reachableStartY; j <= reachableEndY; j++)
2533 {
2534 if (!Main.tile[i, j].active())
2535 {
2536 continue;
2537 }
2538 Tile tile = Main.tile[i, j];
2539 if (!Main.tileAxe[tile.type] || TileID.Sets.IgnoreSmartCursorPriorityAxe[tile.type])
2540 {
2541 continue;
2542 }
2543 int num2 = i;
2544 int k = j;
2545 int type = tile.type;
2547 {
2548 if (Collision.InTileBounds(num2 + 1, k, reachableStartX, reachableStartY, reachableEndX, reachableEndY))
2549 {
2550 if (Main.tile[num2, k].frameY >= 198 && Main.tile[num2, k].frameX == 44)
2551 {
2552 num2++;
2553 }
2554 if (Main.tile[num2, k].frameX == 66 && Main.tile[num2, k].frameY <= 44)
2555 {
2556 num2++;
2557 }
2558 if (Main.tile[num2, k].frameX == 44 && Main.tile[num2, k].frameY >= 132 && Main.tile[num2, k].frameY <= 176)
2559 {
2560 num2++;
2561 }
2562 }
2563 if (Collision.InTileBounds(num2 - 1, k, reachableStartX, reachableStartY, reachableEndX, reachableEndY))
2564 {
2565 if (Main.tile[num2, k].frameY >= 198 && Main.tile[num2, k].frameX == 66)
2566 {
2567 num2--;
2568 }
2569 if (Main.tile[num2, k].frameX == 88 && Main.tile[num2, k].frameY >= 66 && Main.tile[num2, k].frameY <= 110)
2570 {
2571 num2--;
2572 }
2573 if (Main.tile[num2, k].frameX == 22 && Main.tile[num2, k].frameY >= 132 && Main.tile[num2, k].frameY <= 176)
2574 {
2575 num2--;
2576 }
2577 }
2578 for (; Main.tile[num2, k].active() && Main.tile[num2, k].type == type && Main.tile[num2, k + 1].type == type && Collision.InTileBounds(num2, k + 1, reachableStartX, reachableStartY, reachableEndX, reachableEndY); k++)
2579 {
2580 }
2581 }
2582 if (tile.type == 80)
2583 {
2584 if (Collision.InTileBounds(num2 + 1, k, reachableStartX, reachableStartY, reachableEndX, reachableEndY))
2585 {
2586 if (Main.tile[num2, k].frameX == 54)
2587 {
2588 num2++;
2589 }
2590 if (Main.tile[num2, k].frameX == 108 && Main.tile[num2, k].frameY == 36)
2591 {
2592 num2++;
2593 }
2594 }
2595 if (Collision.InTileBounds(num2 - 1, k, reachableStartX, reachableStartY, reachableEndX, reachableEndY))
2596 {
2597 if (Main.tile[num2, k].frameX == 36)
2598 {
2599 num2--;
2600 }
2601 if (Main.tile[num2, k].frameX == 108 && Main.tile[num2, k].frameY == 18)
2602 {
2603 num2--;
2604 }
2605 }
2606 for (; Main.tile[num2, k].active() && Main.tile[num2, k].type == 80 && Main.tile[num2, k + 1].type == 80 && Collision.InTileBounds(num2, k + 1, reachableStartX, reachableStartY, reachableEndX, reachableEndY); k++)
2607 {
2608 }
2609 }
2610 if (tile.type == 323 || tile.type == 72)
2611 {
2612 for (; Main.tile[num2, k].active() && ((Main.tile[num2, k].type == 323 && Main.tile[num2, k + 1].type == 323) || (Main.tile[num2, k].type == 72 && Main.tile[num2, k + 1].type == 72)) && Collision.InTileBounds(num2, k + 1, reachableStartX, reachableStartY, reachableEndX, reachableEndY); k++)
2613 {
2614 }
2615 }
2616 float num3 = Vector2.Distance(new Vector2(num2, k) * 16f + Vector2.One * 8f, providedInfo.mouse);
2617 if (num == -1f || num3 < num)
2618 {
2619 num = num3;
2620 fX = num2;
2621 fY = k;
2622 }
2623 }
2624 }
2625 }
static bool[] IgnoreSmartCursorPriorityAxe
Definition TileID.cs:131
static bool[] IsATreeTrunk
Definition TileID.cs:91
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91

References Microsoft.Xna.Framework.Vector2.Distance(), Terraria.ID.TileID.Sets.IgnoreSmartCursorPriorityAxe, Terraria.Collision.InTileBounds(), Terraria.ID.TileID.Sets.IsATreeTrunk, Terraria.Main.tile, Terraria.Main.tileAxe, System.type, and Terraria.Tile.type.

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